[PyQt] About QSystemTrayIcon, I Need some tips

lists at necoro.eu lists at necoro.eu
Tue Jul 24 00:14:44 BST 2007


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




More information about the PyQt mailing list