[PyQt] About keyPressEvent
"Gustavo A. Díaz"
gustavo.diaz at gmail.com
Thu Aug 23 04:54:59 BST 2007
I did this time:
def keyPressEvent(self, event):
if event.key() == QtCore.Qt.Key_Escape:
if event.key() == QtCore.Qt.Key_Alt + QtCore.Qt.Key_Escape:
Esc key only, hides the app.
Alt + Esc does not, it just close the app.
What is wrong?
/Gustavo A. Díaz/
Gustavo A. Díaz
> Gustavo A. Díaz wrote:
>> As i said, only Escape key.
>> I want to know to do the same but with alt + Escape....... or which
>> is the way to do it...
> Hi Gustavo,
> I am not sure I understand what it is that gives you trouble here. Is it
> that you don't know how to go about it, or is it that it doesn't work
> properly for you?
> In case it's the former, you will probably want to wrap the window
> hiding code under a QAction, and give that QAction the
> shortcut 'Alt+Esc' with QAction.setShortcut().
> Remember that a QAction must be added to a widget (with
> QWidget.addAction()) before its shortcut will work.
> With kind regards,
> -- S.
> PyQt mailing list PyQt at riverbankcomputing.com
-------------- next part --------------
Skipped content of type multipart/related
More information about the PyQt