With this flag enable the function is called in different occasion like @ItemFlagsChange
ItemFlagsHaveChanged
ItemChildAddedChange
ItemSceneChange
ItemSceneHasChanged@
But never when my children move. I will try to connect to xChanged signal.
Edit : I've found a way to make it work @QVariant Line::itemChange ( GraphicsItemChange change, const QVariant & value )
{
if(change == QGraphicsItem::ItemChildAddedChange)
{
QGraphicsItem* item = value.value<QGraphicsItem*>();
QDeclarativeItem* item2 = dynamic_cast<QDeclarativeItem*>(item);
QList<QObject*> loc_o_childrens = children();
foreach(QObject* obj,loc_o_childrens)
{
QDeclarativeItem* child = dynamic_cast<QDeclarativeItem*>(obj);
if(child == item2)
{
connect(child,SIGNAL(xChanged()),this,SLOT(repaint()));
connect(child,SIGNAL(yChanged()),this,SLOT(repaint()));
}
}
}
return QGraphicsItem::itemChange(change, value);
}@
I really dislike this way of doing things but I can't get the ItemPositionChange.