Example #1
0
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());
}