[PyQt] About keyPressEvent

"Gustavo A. Dí­az" gustavo.diaz at gmail.com
Wed Aug 22 03:30:58 BST 2007


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...

cheers.

Henrik Pauli escribió:
> What I was thinking about was this:
> http://doc.trolltech.com/4.3/qt.html#WidgetAttribute-enum ->
> Qt::WA_DeleteOnClose as it's now called.  As I said, I could be
> completely wrong with assuming it being the culprit, but anyway.
>
> Now... isn't the code you pasted actually handling Escape, not Alt+Escape?
>
> On 8/22/07, *"Gustavo A. Dí­az"* < gustavo.diaz at gmail.com
> <mailto:gustavo.diaz at gmail.com>> wrote:
>
>     I think you are missunderstanding....
>
>     I have an app, i have a systray, when i press the close button, it
>     hide on the systray, cause i've implemented that...
>     Now i want to hide the app too when i press alt+esc...not closing it.
>
>     Thanks...
>
>     Cheers.
>
>     Uğur Çetin escribió:
>>     22-08-2007 01:18 Gustavo A. Dí­az:
>>       
>>>     I am trying to catch the keyPressEvent of alt + esc combination with:
>>>
>>>     def keyPressEvent(self, event):
>>>                  if event.key() == QtCore.Qt.Key_Escape:
>>>                      self.hide()
>>>
>>>     And this has no effect, the app closes anyway. What i want is to hide
>>>
>>>     the app and not close it.
>>>
>>>     What i am doing wrong?
>>>         
>>     You should use self.showMinimized() to minimize the window. See QWidget 
>>     documentation. Also see QApplication documentation if you want to use .hide() 
>>     but don't want application to close 
>>     (QApplication.setQuitOnLastWindowClosed
>>     ()).
>>
>>       
>>     ------------------------------------------------------------------------
>>
>>     _______________________________________________
>>     PyQt mailing list    
>>     PyQt at riverbankcomputing.com <mailto:PyQt at riverbankcomputing.com>
>>     http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>>      <http://www.riverbankcomputing.com/mailman/listinfo/pyqt>
>
>
>     -- 
>     /Gustavo A. Díaz/
>     *GDNet Projects*
>     www.gdnet.com.ar <http://www.gdnet.com.ar>
>     Gustavo A. Díaz
>
>     _______________________________________________
>     PyQt mailing list    PyQt at riverbankcomputing.com
>     <mailto:PyQt at riverbankcomputing.com>
>     http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt


-- 
/Gustavo A. Díaz/
*GDNet Projects*
www.gdnet.com.ar <http://www.gdnet.com.ar>
Gustavo A. Díaz
-------------- next part --------------
Skipped content of type multipart/related


More information about the PyQt mailing list