Solved MousePressEvent - space pressed/hold/check?
-
Hey
I'm in mousePressEvent. I can get button/s () to determine what mouse button got pressed and I can use QGuiApplication::keyboardModifiers(); to get what modifier got pressed, but how can I check if space was pressed? I mean I want to know if some one is holding space while pressing mouse button.
-
@Dariusz
Since there does not appear to be a Qt function to tell you if a (non-modifier) key is being pressed, you can use the generic key pressed & released events to track the spacebar down/up for yourself, and use the result in your mouse press event. -
Hey
Ended up installing custom event filter which had event filter that emmited a signal when it was pressed/released. Had to do it this wa as I had to install event filter on both graphicsView and Viewport()
For any1 interested, the installed class was a QObject with eventFIlter replaced with my signal that send info out when key was pressed. This way if I have mouse move event in action and I press/release key I get proper updates on the go.