python 3.x - QT Designer how to assign 2 hotkeys to a QPushButton (python3) -
i created simple gui , assigned "enter" qpushbutton ("begin"). line it:
self.begin.setshortcut(_translate("form", "enter"))
evrything works perfectly, how assign 2 variants of hotkey same button? want button react 2 hotkeys: enter , return (usual "big enter" , "small enter" on numpad)
thanks in advance.
there several ways this. simplest use qshortcut
:
qshortcut(qt.key_enter, self.begin, self.handlebegin) qshortcut(qt.key_return, self.begin, self.handlebegin)
to button animation behaviour, try instead:
qshortcut(qt.key_enter, self.begin, self.begin.animateclick) qshortcut(qt.key_return, self.begin, self.begin.animateclick)
Comments
Post a Comment