HoverMouseEvent - Increase Time User Has to Hover over before active
-
What I would like to do is be able to set the time a user has to hover over an qGraphicsItem before say a popup window is shown.
I am obviously well aware of hoverEnterEvent, hoverLeaveEvent and hoverMouseEvent, but what I would like to do (and can't work out) is be able to change the time a user has to hover over an item before I decide that was definitely the user trying to activate the popup.
At the moment, it is far too easy for the user to accidentally swiftly move the mouse over the item and it show the popup, as QT is registering this as a hover event.
I guess I could use some sort of timer and only if the hoverLeaveEvent hasn't been fired in that time, but that seems a very inefficient way of doing things.
-
A QTimer which starts when the user enter your Widget would be a great easy solution.
If the user leaves the widget, stop the timer.
The timeout of the timer would trigger your popup. (User stayed for X seconds hovering your widget)Not inefficient, not sure what you mean?
Good luck! -
My concern with Timer is that I am likely to have a lot of QGraphicItems and the user will be moving the mouse rapidly over them on a constant basis. Thus, I am concerned I will end up with a large number of timers all starting / stopping / running at the same time, and this could cause performance issues.
-
You could subclass QGraphicItems and implement the behavior only once there.
Another thing to consider is using tooltip or asking the user to click on the QGraphicItem to trigger the pop-up instead of hovering. I haven't seem much software that open pop-up without the user asking for it, I would be annoyed by pop-up openning if it's not clear that my action opened it.