Shortcut how handle permanent key press action
-
I would like to use a shortcut on a PushButton ... PushButton is linked to a pressed action and released action function .... I make a shortcut with the F10 key .... but I would like the PushButto to remain in pressed state as long as the F10 key is pressed .... now if I hold down F10 I get a series of PushButton pressed and released actions ....
Override keypressEvent and keyReleaseEvent not help .....
thanks a lot for any cuggest
-
I would like to use a shortcut on a PushButton ... PushButton is linked to a pressed action and released action function .... I make a shortcut with the F10 key .... but I would like the PushButto to remain in pressed state as long as the F10 key is pressed .... now if I hold down F10 I get a series of PushButton pressed and released actions ....
Override keypressEvent and keyReleaseEvent not help .....
thanks a lot for any cuggest
@gfxx said in Shortcut how handle permanent key press action:
Override keypressEvent and keyReleaseEvent not help .....
But that's the only way...
QShortcutcant differentiate between press and release...Override press- and releaseEvent and keep your button in pressed/down state, until you get a
F10-keyReleaseEvent. -
I like software layering...an alternate approach that I would use would be to create a custom pushbutton that provides the behavior. pushbuttons have an abstract base interface. Start there or look at subclassing QPushbutton.