[PySide] Update menu in system tray application
Jacob Fizz
fizz.jacob at gmail.com
Sun Jul 20 10:04:34 CEST 2014
Hello,
I am building a System tray application using PySide. However I am not able
to update the menu items. On Ubuntu (14.04 LTS) while updating the menu,
there seems to be no change but its said to be working on Windows (8)
machine. Is this something related to PySide or QT itself ?
Below is the code I tried.
from PySide.QtGui import *import sys
class MainWindow(QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
self.tray =
QSystemTrayIcon(QApplication.style().standardIcon(QStyle.SP_DriveDVDIcon),
self)
self.m = QMenu()
self.m.addAction('First')
self.m.addAction('Second')
self.tray.setContextMenu(self.m)
self.tray.show()
p = QPushButton("Click Me", self)
self.setCentralWidget(p)
p.clicked.connect(self.onClick)
def onClick(self):
self.m.clear()
self.m.addAction('First')
self.m.addAction('Third')
self.tray.setContextMenu(self.m)
app = QApplication(sys.argv)
w = MainWindow()
w.show();
sys.exit(app.exec_())
There is a discussion in stackoverflow regarding this issue at
http://stackoverflow.com/questions/24848175/update-menu-in-qt-system-tray-application.
Can anyone check this issue on a Mac ?
Can someone help me in making this to work under Linux/Ubuntu.
Thanks & Regards,
Jacob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20140720/a7b16061/attachment.html>
More information about the PySide
mailing list