Ok, never mind, now i did what i wanted with:

if reason != QtGui.QSystemTrayIcon.Context:
           self.hide()

So when i click in the tray, will hide and with another click will show.

Thats perfects, now i have left the problem about closing the app and not
being hide intro the systray
Is the any way to make an event when closing the mainapp (with the close
button of the WM) to hide in the systray?

Thanks!!

2007/7/23, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:

Gustavo A. Díaz schrieb:
> Another thing i wan to implement is to click on the systray of the app
and
> hide it, and click again to show it. I was trying but without
success...
>

this is how I've done it:

Qt.QObject.connect(self.systray,
Qt.SIGNAL("activated(QSystemTrayIcon::ActivationReason)"),
self.cb_systray_activated)

def cb_systray_activated (self, reason):
        if reason != Qt.QSystemTrayIcon.Context: # do not react on context
menu
calls
        if self.windowState() & Qt.Qt.WindowMinimized: # window is
minimized
                self.show()
                self.showNormal()
        else: # window is not minimized
                self.setWindowState(self.windowState() |
Qt.Qt.WindowMinimized)

Regards,
Necoro


_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt




--
Gustavo A. Díaz
GDNet Projects
www.gdnet.com.ar
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to