QGraphicsView - track mouse position without press?
Solved
General and Desktop
-
Hey
I have few qGraphicItems in my scene/view. I'd like to enlarge them if mouse is within x distance from the item. So that pressing on them is easier in case they are small.
Can any1 suggest how I can track the mouse in graphic view & more ?
I tried getting mouseMoveEvent and then somehow see if there is a "visible items" array in view to loop over to check their position/distance from mouse. But the mouseMoveEvent don't get fired till the mouse button is pressed so that did not work.
What other events can I use? Do I need to installe some event filter?
-
you need to enable the mouseTracking with setMouseTracking(true) for graphicsView. Then you can track the mouseMovment without press and move. Use setAcceptHoverEvents(..) on GraphicsItem