ThingView::ThingView(const Thing& thing, QGraphicsItem *parent) : QGraphicsPolygonItem(parent) { /* colorize! */ setAppearanceDependingOnID(thing.id()); /* we need the body only to connect to it. no reference is stored. */ connect(&thing, SIGNAL(changedPosition(QTransform)), this, SLOT(bodyChanged(QTransform))); /* initially set our location parameters */ bodyChanged(thing.getWorldMap()); /* adept our model's shape */ setPolygon(thing.shape()); }
void UserStatusUpdate::SetBody(const QString& body) { if (m_Body != body) { m_Body = body; emit bodyChanged(); } }
void MockNotification::setBody(const QString &body) { if(p->body != body) { p->body = body; Q_EMIT bodyChanged(p->body); Q_EMIT dataChanged(p->id); } }
void Notification::setBody(const QString &body) { if (body_ != body) { body_ = body; emit bodyChanged(); } }
void Scene::addBody( Body* b ) { emit layoutAboutToBeChanged(); connect( b,SIGNAL(changed()),this,SLOT(bodyChanged())); m_bodys.push_back( b ); b->setParent(this); emit changed(); emit layoutChanged(); }
void TiledObject::setBody(Box2DBody *body) { if(m_body == body) return; m_body = body; emit bodyChanged(); }
void MainPageModelItem::setBody(const QString &body) { if( p->body == body ) return; p->body = body; emit bodyChanged(); }
void Scene::makeNew(const QSize& size) { clearSelection(); beginResetModel(); m_worldSize = size; if (m_static_body) delete m_static_body; m_static_body = 0; foreach( Body* b, m_bodys ) { delete b; } m_bodys.clear(); m_static_body = new StaticBody(this,"static",this); connect( m_static_body,SIGNAL(changed()),this,SLOT(bodyChanged())); m_history->clear(); endResetModel(); m_filename.clear(); emit changed(); }
bool Scene::load(const QString& fn) { QFile file(fn); if (!file.open(QIODevice::ReadOnly)) { return false; } QByteArray data = file.readAll(); QDomDocument doc; if (!doc.setContent(data)) { return false; } clearSelection(); beginResetModel(); m_history->clear(); if (m_static_body) delete m_static_body; m_static_body = 0; foreach( Body* b, m_bodys ) { delete b; } m_bodys.clear(); QDomElement root = doc.documentElement(); m_worldSize.setWidth(root.attribute("width").toInt()); m_worldSize.setHeight(root.attribute("height").toInt()); QDomElement node = root.firstChildElement("body"); while (node.isElement()) { QString type = node.attribute("type"); Body* b = 0; if (type=="StaticBody") { b = new StaticBody(this,"body",this); ReadAttributes(b,node); if (!m_static_body) m_static_body = b; else { m_bodys.push_back( b ); } } else if (type=="DynamicBody") { b = new DynamicBody(this,"body",this); ReadAttributes(b,node); m_bodys.push_back( b ); } if (b) { QDomElement primNode = node.firstChildElement("primitive"); while (primNode.isElement()) { Primitive* p = 0; QString type = primNode.attribute("type"); p = Primitive::create(type,b,this); if (p) { ReadAttributes(p,primNode); b->addPrimitive(p); } primNode = primNode.nextSiblingElement("primitive"); } connect( b,SIGNAL(changed()),this,SLOT(bodyChanged())); } node = node.nextSiblingElement("body"); } endResetModel(); m_filename = fn; emit changed(); return true; }