How is proper way to catch mouse release outside app?
-
Hi,
I have myScrollBar ( inherits QScrollBar ). I would like to know when scrollBar is kept by user, so I would like to know when user click on sroll bar, keep it and release it. I have it using mousePressEvent and mouseReleaseEvent, but I have problem, when user kept scrollBar, move mouse outside app and release it. I don't see it.
-
That's because your application doesn't get the events due to the release being outside of its supposed scope. Now, it's possible to capture them exclusively with
QWidget::grabMouse
, but the usual warnings apply. Make sure you don't have bugs in that code, as it's rather easy to kill the usability of the system by not releasing the mouse ...Note: Also there are platform differences, so check the documentation out.
Note 2: You could try to respond sensibly to the mouse leave event as an alternative.