When QGraphicsScene empty space in the Scene ?
-
Can you help us with sample program & behaviour you are expecting ? This helps the forum team to help you.
-
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
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 ? -
@mrjj
Yes. Hopefully the previously selected items will be retained when the user presses the Ctrl key on the key squeeze, clicks on an empty space, or drags and drops on an empty space to create the region.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 } } -
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 } }