[PyQt] About keyPressEvent

"Gustavo A. Dí­az" gustavo.diaz at gmail.com
Fri Aug 24 06:42:46 BST 2007


Well, setQuitOnLastWindowClosed(False) solved that problem now the
pressKeyEven works perfect:

if event.key() == QtCore.Qt.Key_Escape and (event.modifiers() &
        QtCore.Qt.AltModifier):
            self.hide()

Now, i used closeEvent to close my app from the systray, so i've
implemented a new fuction for that.

Thanks!!


Rob Knapp escribió:
>> What I suddenly think about is that you should try to catch some 
>> signal (I can't remember the name, but do read up on what signals and 
>> slots a QMainWindow/KMainWindow has) that is related to quitting the 
>> application. I seem to remember there are methods which get triggered 
>> at exit -- you could perhaps rewire them somehow. 
>>
>>     
>
> This is good advice.... however, I also have a systray application, and do not 
> see the behavior the original poster is talking about.  I can hit Alt-F4 or Alt-Esc (which for me on GNOME minimzes) all day and my app stays up.  (Well, ok... not all day, but well after the last window is closed.....)
>
> Perhaps you (the original poster) should double check and make sure that you are calling setQuitOnLastWindowClosed(False) on your QApplication instance before your call to exec_.  Sounds silly I know, but more than once I've been moving code around and missed a line or two.  
> ---
> Rob Knapp
> 	Lead Developer
> 	www.bizling.com
> _______________________________________________
> 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