When QGraphicsScene empty space in the Scene ?
Solved
General and Desktop
-
Can you help us with sample program & behaviour you are expecting ? This helps the forum team to help you.
-
If you select one or more items in QGraphicsView and then hold down the Ctrl key on the keyboard and click on an empty space in the GraphicsView, will the selected items be initialized and can be resolved?
-
Hi
Normally when you click on empty space while holding down CTRL, nothing will happen.
However, if you do not hold CTRL down and click on empty space, the selection will
be cleared.
Is that what you want to remove? So selection stays even if user click on empty space ? -
Hi
You can do something likevoid MyScene::mousePressEvent (QGraphicsSceneMouseEvent *mouseEvent) { // if left mouse pressed and there is items under the mouse pos. if ((mouseEvent->buttons () & Qt::LeftButton) && items (mouseEvent->scenePos ()).count()) { QGraphicsScene::mousePressEvent (mouseEvent); } else { mouseEvent->accept (); // eat event } }