The PySide.QtGui.QSystemTrayIcon class provides an icon for an application in the system tray.
Modern operating systems usually provide a special area on the desktop, called the system tray or notification area , where long-running applications can display icons and short messages.
The PySide.QtGui.QSystemTrayIcon class can be used on the following platforms:
- All supported versions of Windows.
- All window managers for X11 that implement the freedesktop.org system tray specification, including recent versions of KDE and GNOME.
- All supported versions of Mac OS X. Note that the Growl notification system must be installed for QSystemTrayIcon.showMessage() to display messages.
To check whether a system tray is present on the user’s desktop, call the QSystemTrayIcon.isSystemTrayAvailable() static function.
To add a system tray entry, create a PySide.QtGui.QSystemTrayIcon object, call PySide.QtGui.QSystemTrayIcon.setContextMenu() to provide a context menu for the icon, and call PySide.QtGui.QSystemTrayIcon.show() to make it visible in the system tray. Status notification messages (“balloon messages”) can be displayed at any time using PySide.QtGui.QSystemTrayIcon.showMessage() .
If the system tray is unavailable when a system tray icon is constructed, but becomes available later, PySide.QtGui.QSystemTrayIcon will automatically add an entry for the application in the system tray if the icon is visible() .
The PySide.QtGui.QSystemTrayIcon.activated() signal is emitted when the user activates the icon.
Only on X11, when a tooltip is requested, the PySide.QtGui.QSystemTrayIcon receives a PySide.QtGui.QHelpEvent of type QEvent.ToolTip . Additionally, the PySide.QtGui.QSystemTrayIcon receives wheel events of type QEvent.Wheel . These are not supported on any other platform.
See also
PySide.QtGui.QDesktopServices PySide.QtGui.QDesktopWidget Desktop Integration System Tray Icon Example
Parameters: |
|
---|
Constructs a PySide.QtGui.QSystemTrayIcon object with the given parent .
The icon is initially invisible.
See also
visible()
Constructs a PySide.QtGui.QSystemTrayIcon object with the given icon and parent .
The icon is initially invisible.
See also
visible()
This enum describes the icon that is shown when a balloon message is displayed.
Constant | Description |
---|---|
QSystemTrayIcon.NoIcon | No icon is shown. |
QSystemTrayIcon.Information | An information icon is shown. |
QSystemTrayIcon.Warning | A standard warning icon is shown. |
QSystemTrayIcon.Critical | A critical warning icon is shown. |
See also
This enum describes the reason the system tray was activated.
Constant | Description |
---|---|
QSystemTrayIcon.Unknown | Unknown reason |
QSystemTrayIcon.Context | The context menu for the system tray entry was requested |
QSystemTrayIcon.DoubleClick | The system tray entry was double clicked |
QSystemTrayIcon.Trigger | The system tray entry was clicked |
QSystemTrayIcon.MiddleClick | The system tray entry was clicked with the middle mouse button |
Parameters: | reason – PySide.QtGui.QSystemTrayIcon.ActivationReason |
---|
Return type: | PySide.QtGui.QMenu |
---|
Returns the current context menu for the system tray entry.
Return type: | PySide.QtCore.QRect |
---|
Returns the geometry of the system tray icon in screen coordinates.
See also
visible()
Hides the system tray entry.
See also
PySide.QtGui.QSystemTrayIcon.show() visible()
Return type: | PySide.QtGui.QIcon |
---|
This property holds the system tray icon.
On Windows, the system tray icon size is 16x16; on X11, the preferred size is 22x22. The icon will be scaled to the appropriate size as necessary.
Return type: | PySide.QtCore.bool |
---|
Returns true if the system tray is available; otherwise returns false.
If the system tray is currently unavailable but becomes available later, PySide.QtGui.QSystemTrayIcon will automatically add an entry in the system tray if it is visible() .
Return type: | PySide.QtCore.bool |
---|
This property holds whether the system tray entry is visible.
Setting this property to true or calling PySide.QtGui.QSystemTrayIcon.show() makes the system tray icon visible; setting this property to false or calling PySide.QtGui.QSystemTrayIcon.hide() hides it.
Parameters: | menu – PySide.QtGui.QMenu |
---|
Sets the specified menu to be the context menu for the system tray icon.
The menu will pop up when the user requests the context menu for the system tray icon by clicking the mouse button.
On Mac OS X, this is currenly converted to a NSMenu, so the aboutToHide() signal is not emitted.
Note
The system tray icon does not take ownership of the menu. You must ensure that it is deleted at the appropriate time by, for example, creating the menu with a suitable parent object.
Parameters: | icon – PySide.QtGui.QIcon |
---|
This property holds the system tray icon.
On Windows, the system tray icon size is 16x16; on X11, the preferred size is 22x22. The icon will be scaled to the appropriate size as necessary.
Parameters: | tip – unicode |
---|
This property holds the tooltip for the system tray entry.
On some systems, the tooltip’s length is limited. The tooltip will be truncated if necessary.
Parameters: | visible – PySide.QtCore.bool |
---|
This property holds whether the system tray entry is visible.
Setting this property to true or calling PySide.QtGui.QSystemTrayIcon.show() makes the system tray icon visible; setting this property to false or calling PySide.QtGui.QSystemTrayIcon.hide() hides it.
Shows the icon in the system tray.
See also
PySide.QtGui.QSystemTrayIcon.hide() visible()
Parameters: |
|
---|
Shows a balloon message for the entry with the given title , message and icon for the time specified in millisecondsTimeoutHint . title and message must be plain text strings.
Message can be clicked by the user; the PySide.QtGui.QSystemTrayIcon.messageClicked() signal will emitted when this occurs.
Note that display of messages are dependent on the system configuration and user preferences, and that messages may not appear at all. Hence, it should not be relied upon as the sole means for providing critical information.
On Windows, the millisecondsTimeoutHint is usually ignored by the system when the application has focus.
On Mac OS X, the Growl notification system must be installed for this function to display messages.
Return type: | PySide.QtCore.bool |
---|
Returns true if the system tray supports balloon messages; otherwise returns false.
Return type: | unicode |
---|
This property holds the tooltip for the system tray entry.
On some systems, the tooltip’s length is limited. The tooltip will be truncated if necessary.