I have two QGraphicsRectItem objects with one being the child of the other. So I have a parent and a child.
I'm trying to track the movement of the child whenever the parent is moved.
These two flags are set for both object.
setFlag(ItemIsMovable);
setFlag(ItemSendsGeometryChanges);
When the parent item is moved itemChanged() is called with ItemPositionHasChanged,
but the child's is never called. I tried using ItemParentHasChanged, but that isn't being called.
Anyone have any thoughts? Here's the function:
{
switch (change) {
case ItemPositionHasChanged:
qDebug() << "ItemPositionHasChanged";
break;
case ItemParentHasChanged:
qDebug() << "ItemParentHasChanged;
break;
default:
break;
};
return QGraphicsItem::itemChange(change, value);
}
QVariant Node::itemChange(GraphicsItemChange change, const QVariant &value)
{
switch (change) {
case ItemPositionHasChanged:
qDebug() << "ItemPositionHasChanged";
break;
case ItemParentHasChanged:
qDebug() << "ItemParentHasChanged;
break;
default:
break;
};
return QGraphicsItem::itemChange(change, value);
}
To copy to clipboard, switch view to plain text mode
Bookmarks