Two problems with QSystemTrayIcon
2013-01-31 20:00
190 查看
http://www.riverbankcomputing.co.uk/pipermail/pyqt/2008-March//018914.html
I know it's been a while since you posted (and even long since I've read the list archives), so maybe you have figured this out already, but just in case (and so future folks can Google it)... In order to make the tray icon disappear properly, you need to call hide() or setVisible(False) on it first, but of course you have to do that within your main loop. So you'll probably need to hook your quit signal up to a helper function that will hide the tray, then actually exit. Hope this helps, -Adam Batkin duncan duncan wrote: > Hello. > > I am trying to put an icon into the system tray area using > QSystemTrayIcon. All work well except when I close the program. > > I put the icon in the area using this code: > > ---- > icon=QtGui.QIcon("pixmaps/todo_list.png") > systray=QtGui.QSystemTrayIcon(icon) > #systray.setIcon(icon) > menu = QtGui.QMenu() > quitAction = menu.addAction('Quit') > systray.setContextMenu(menu) > quitAction.connect(quitAction, QtCore.SIGNAL("triggered()"), > ui.QuitApp) > systray.show() > > sys.exit(app.exec_()) > ----- > > I have two minor problems: > > 1) when I close the program, the icon stay in the tray area until I move > the mouse pointer over it, at this point it go away > 2) after exiting from the program, I get this error: > QApplication::qAppName: Please instantiate the QApplication object first > > I have the feeling that the two problems are connected, but I cannot > find a clue > > I am working with Qt 4.3.3 and PyQt4.3.3.2 under Windows XP > > Any suggestions ? > > thanks in advance > Gianluca > >
相关文章推荐
- QSystemTrayIcon menu无法消失问题
- windows系统通知区域编程(SystemTray or NotificationIcon)
- Making a System Tray Icon for your application
- Easy steps to create a System Tray Application with C# z
- QSystemTrayIcon增加系统托盘图标Demo
- 在QML中使用QSystemTrayIcon(系统托盘)
- Problems with System.OutOfMemoryException At System.String.GetStringForStringBuilder in 32-Bit Managed Solutions
- QSystemTrayIcon
- Pyqt QSystemTrayIcon 实现托盘效果
- QT System Tray Icon Example 看看看~
- Qt类之:QSystemTrayIcon
- How To Manipulate Icons in the System Tray with Visual Basic
- System Tray Icon Example
- Programmatically display system tray icon on Windows Mobile
- 窗体部件之QSystemTrayIcon
- How Can I Minimize a VI to an Icon on the Windows System Tray?
- Qt之QSystemTrayIcon
- 关于QT的QSystemTrayIcon的上下文菜单失去焦点仍然显示的问题
- 如何显示system tray icon
- Problems with System.OutOfMemoryException At System.String.GetStringForStringBuilder in 32-Bit Managed Solutions