[PyQt] About QSystemTrayIcon, I Need some tips

Gustavo A. Díaz gustavo.diaz at gmail.com
Tue Jul 24 01:34:59 BST 2007


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, lists at necoro.eu <lists at necoro.eu>:
>
> 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    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>



-- 
Gustavo A. Díaz
GDNet Projects
www.gdnet.com.ar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070724/ea912bb9/attachment-0001.html


More information about the PyQt mailing list