Qt 6.11 is out! See what's new in the release
blog
KeyReleaseEvent() not picked up after opening file chooser with shortcut Ctrl+O
General and Desktop
3
Posts
2
Posters
1.9k
Views
1
Watching
-
Hello,
I have implemented a Ctrl+wheelEvent for a zoom action on a QGraphicsView. I manage this by picking up the keyPressEvent(), set a self.ctrl = True value and on keyReleaseEvent() I set the self.ctrl = False.
It works correctly except when I open the file chooser with Ctrl+O, in which case the keyPressEvent() is picked up, but the keyReleaseEvent() is not. Because of this the self.ctrl remains True and a wheelEvent alone is then able to activate the zoom action without the Ctrl key being pressed.
I work around this by setting the self.ctrl value to False right after the file chooser has done its job, but I find this an ugly way to solve the issue.
So did I implement this the wrong way? What's the best practice? Thanks.