Hello,
I have a QGraphicsItem, called myitem, which has several children. When myitem is selected I want to display its children and when it is not selected, I hide them. While the children weren't selectable, it worked perfectly with something like that :
Qt Code:
{ { if(value.toBool()) { //item is selected showChildren(true); }else { //item is deselected showChildren(false); } } ... }To copy to clipboard, switch view to plain text mode
But now the children of myitem are selectable and the above code doesn't work anymore because if I deselect myitem to select one of its children I hide it. In this situation, I shouldn't hide the children of myitem.
So I have to know the new selected item in QGraphicItem::itemChange to correctly show/hide the children. How can I do that ?
In change == QGraphicsItem::ItemSelectedChange or change == QGraphicsItem::ItemSelectedhasChanged, scene()->selectedItems() doesn't return the newly selected items.
Thank you
Bookmarks