Drawing a selection rectangle & put a hand selection
Solved
General and Desktop
-
Hi, i want to put a selection rectangle and a hand selection on my form when one of them is select (like the picture bellow)
i've try this :
void Scene::Affichage_Scene() { QGraphicsView *view = new QGraphicsView(qscene); view->setDragMode(QGraphicsView::ScrollHandDrag); view->setDragMode(QGraphicsView::RubberBandDrag); view->setWindowTitle("Form"); view->show(); }
But that doesn't work :
Can you pls help me ? thanks.
-
Hi and welcome to devnet,
Did you make your items selectable ?
-
Yes, i have add QGraphicsItem::ItemIsMovable and now the selection rectangle is enable
but not the hand selection when i have the mouse pointer on the form !
-
Do you mean you would like the cursor to change when on top of a movable item ?
-
Then I would use an event filter and when an item gets a focus in event change the cursor for the hand and back to normal on focus out.