[PyKDE] How to connect QSystemTrayIcon activated() signal?

Wiktor Grębla greblus at gmail.com
Sat Nov 4 16:46:10 GMT 2006


Hello again.

I can't get activated() to work. Sample code:

	[...]
        self.tray = QtGui.QSystemTrayIcon(self)
	[...]

        self.tmenu = QtGui.QMenu()
        self.tquit = QtGui.QAction(u'Exit', self)
        self.thide = QtGui.QAction(u'Hide', self)
        self.tshow = QtGui.QAction(u'Show', self)
        self.tmenu.addAction(self.tshow)
        self.tmenu.addAction(self.thide)
        self.tmenu.addSeparator()
        self.tmenu.addAction(self.tquit)
        self.tray.setContextMenu(self.tmenu)
        self.connect(self.tquit, QtCore.SIGNAL("triggered()"), self.on_exit)
        self.connect(self.tshow, QtCore.SIGNAL("triggered()"), self.show)
        self.connect(self.thide, QtCore.SIGNAL("triggered()"), self.hide)

# the above works

        self.connect(self.tray, QtCore.SIGNAL("activated(QtGui.QSystemTrayIcon.Trigger)"), self.on_trayclicked)

# this doesn't work

[...]

What should i do to make it work as expected?

Regards,
W.

-- 
Talkers are no good doers.
http://greblus.net/djangoblog/




More information about the PyQt mailing list