[PyKDE] How to connect QSystemTrayIcon activated() signal?
Phil Thompson
phil at riverbankcomputing.co.uk
Sat Nov 4 17:02:31 GMT 2006
On Saturday 04 November 2006 4:46 pm, Wiktor Grębla wrote:
> 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?
Signal arguments must be C++ signatures not Python ones, so
use "activated(QSystemTrayIcon::ActivationReason").
Phil
More information about the PyQt
mailing list