Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.6.3, 5.12
-
None
Description
This bug can be reproduced using the 40000 Chips QT example, but changing this line in chip.cpp:
setFlags(ItemIsSelectable | ItemIsMovable);
to:
setFlag(ItemIsSelectable, true);
setFlag(ItemIsMovable, false);
After that, any selected items are cleared on right clicking with the mouse.
This bug is related to
https://bugreports.qt.io/browse/QTBUG-10138
and:
https://bugreports.qt.io/browse/QTBUG-2305
However, one thing that was not informed in the previous bug reports, or documented anywhere, is that it only happens if QGraphicsItem::ItemIsMovable is set to false.
This is a non expected behaviour when QGraphicsItem::ItemIsSelectable is set to true.
In my case I have non movable items where I would like to add actions to the selected items on right click. And as of today it is impossible unless I do some ugly hacking.
The workaround described here (https://www.qtcentre.org/threads/36953-QGraphicsItem-deselected-on-contextMenuEvent) does not work perfectly for me since selectedItems() and focusItem() are not updated.