<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html><head><title>QSystemTrayIcon Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } td.postheader { font-family: sans-serif } tr.address { font-family: sans-serif } body { background: #ffffff; color: black; } </style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QSystemTrayIcon Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QSystemTrayIcon class provides an icon for an application in the system tray. <a href="#details">More...</a></p> <p>Inherits <a href="qobject.html">QObject</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qsystemtrayicon.html#ActivationReason-enum">ActivationReason</a></b> { Unknown, Context, DoubleClick, Trigger, MiddleClick }</li><li><div class="fn" />enum <b><a href="qsystemtrayicon.html#MessageIcon-enum">MessageIcon</a></b> { NoIcon, Information, Warning, Critical }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qsystemtrayicon.html#QSystemTrayIcon">__init__</a></b> (<i>self</i>, QObject <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qsystemtrayicon.html#QSystemTrayIcon-2">__init__</a></b> (<i>self</i>, QIcon <i>icon</i>, QObject <i>parent</i> = None)</li><li><div class="fn" />QMenu <b><a href="qsystemtrayicon.html#contextMenu">contextMenu</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsystemtrayicon.html#event">event</a></b> (<i>self</i>, QEvent <i>event</i>)</li><li><div class="fn" />QRect <b><a href="qsystemtrayicon.html#geometry">geometry</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsystemtrayicon.html#hide">hide</a></b> (<i>self</i>)</li><li><div class="fn" />QIcon <b><a href="qsystemtrayicon.html#icon">icon</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsystemtrayicon.html#isVisible">isVisible</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsystemtrayicon.html#setContextMenu">setContextMenu</a></b> (<i>self</i>, QMenu <i>menu</i>)</li><li><div class="fn" /><b><a href="qsystemtrayicon.html#setIcon">setIcon</a></b> (<i>self</i>, QIcon <i>icon</i>)</li><li><div class="fn" /><b><a href="qsystemtrayicon.html#setToolTip">setToolTip</a></b> (<i>self</i>, QString <i>tip</i>)</li><li><div class="fn" /><b><a href="qsystemtrayicon.html#setVisible">setVisible</a></b> (<i>self</i>, bool <i>visible</i>)</li><li><div class="fn" /><b><a href="qsystemtrayicon.html#show">show</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsystemtrayicon.html#showMessage">showMessage</a></b> (<i>self</i>, QString <i>title</i>, QString <i>msg</i>, MessageIcon <i>icon</i> = QSystemTrayIcon.Information, int <i>msecs</i> = 10000)</li><li><div class="fn" />QString <b><a href="qsystemtrayicon.html#toolTip">toolTip</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />bool <b><a href="qsystemtrayicon.html#isSystemTrayAvailable">isSystemTrayAvailable</a></b> ()</li><li><div class="fn" />bool <b><a href="qsystemtrayicon.html#supportsMessages">supportsMessages</a></b> ()</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qsystemtrayicon.html#activated">activated</a></b> (QSystemTrayIcon::ActivationReason)</li><li><div class="fn" />void <b><a href="qsystemtrayicon.html#messageClicked">messageClicked</a></b> ()</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QSystemTrayIcon class provides an icon for an application in the system tray.</p> <p>Modern operating systems usually provide a special area on the desktop, called the <i>system tray</i> or <i>notification area</i>, where long-running applications can display icons and short messages.</p> <p class="centerAlign"><img alt="The system tray on Windows XP." src="images/system-tray.png" /></p> <p>The QSystemTrayIcon class can be used on the following platforms:</p> <ul> <li>All supported versions of Windows.</li> <li>All window managers for X11 that implement the <a href="http://www.freedesktop.org/">freedesktop.org</a> system tray specification, including recent versions of KDE and GNOME.</li> <li>All supported versions of Mac OS X. Note that the Growl notification system must be installed for <a href="qsystemtrayicon.html#showMessage">QSystemTrayIcon.showMessage</a>() to display messages.</li> </ul> <p>To check whether a system tray is present on the user's desktop, call the <a href="qsystemtrayicon.html#isSystemTrayAvailable">QSystemTrayIcon.isSystemTrayAvailable</a>() static function.</p> <p>To add a system tray entry, create a QSystemTrayIcon object, call <a href="qsystemtrayicon.html#setContextMenu">setContextMenu</a>() to provide a context menu for the icon, and call <a href="qsystemtrayicon.html#show">show</a>() to make it visible in the system tray. Status notification messages ("balloon messages") can be displayed at any time using <a href="qsystemtrayicon.html#showMessage">showMessage</a>().</p> <p>If the system tray is unavailable when a system tray icon is constructed, but becomes available later, QSystemTrayIcon will automatically add an entry for the application in the system tray if the icon is <a href="qsystemtrayicon.html#visible-prop">visible</a>.</p> <p>The <a href="qsystemtrayicon.html#activated">activated</a>() signal is emitted when the user activates the icon.</p> <p>Only on X11, when a tooltip is requested, the QSystemTrayIcon receives a <a href="qhelpevent.html">QHelpEvent</a> of type <a href="qevent.html#Type-enum">QEvent.ToolTip</a>. Additionally, the QSystemTrayIcon receives wheel events of type <a href="qevent.html#Type-enum">QEvent.Wheel</a>. These are not supported on any other platform.</p> <hr /><h2>Type Documentation</h2><h3 class="fn"><a name="ActivationReason-enum" />QSystemTrayIcon.ActivationReason</h3><p>This enum describes the reason the system tray was activated.</p> <table class="valuelist"> <tr class="odd" valign="top"> <th class="tblConst">Constant</th> <th class="tblval">Value</th> <th class="tbldscr">Description</th> </tr> <tr> <td class="topAlign"><tt>QSystemTrayIcon.Unknown</tt></td> <td class="topAlign"><tt>0</tt></td> <td class="topAlign">Unknown reason</td> </tr> <tr> <td class="topAlign"><tt>QSystemTrayIcon.Context</tt></td> <td class="topAlign"><tt>1</tt></td> <td class="topAlign">The context menu for the system tray entry was requested</td> </tr> <tr> <td class="topAlign"><tt>QSystemTrayIcon.DoubleClick</tt></td> <td class="topAlign"><tt>2</tt></td> <td class="topAlign">The system tray entry was double clicked</td> </tr> <tr> <td class="topAlign"><tt>QSystemTrayIcon.Trigger</tt></td> <td class="topAlign"><tt>3</tt></td> <td class="topAlign">The system tray entry was clicked</td> </tr> <tr> <td class="topAlign"><tt>QSystemTrayIcon.MiddleClick</tt></td> <td class="topAlign"><tt>4</tt></td> <td class="topAlign">The system tray entry was clicked with the middle mouse button</td> </tr> </table> <p><b>See also</b> <a href="qsystemtrayicon.html#activated">activated</a>().</p> <h3 class="fn"><a name="MessageIcon-enum" />QSystemTrayIcon.MessageIcon</h3><p>This enum describes the icon that is shown when a balloon message is displayed.</p> <table class="valuelist"> <tr class="odd" valign="top"> <th class="tblConst">Constant</th> <th class="tblval">Value</th> <th class="tbldscr">Description</th> </tr> <tr> <td class="topAlign"><tt>QSystemTrayIcon.NoIcon</tt></td> <td class="topAlign"><tt>0</tt></td> <td class="topAlign">No icon is shown.</td> </tr> <tr> <td class="topAlign"><tt>QSystemTrayIcon.Information</tt></td> <td class="topAlign"><tt>1</tt></td> <td class="topAlign">An information icon is shown.</td> </tr> <tr> <td class="topAlign"><tt>QSystemTrayIcon.Warning</tt></td> <td class="topAlign"><tt>2</tt></td> <td class="topAlign">A standard warning icon is shown.</td> </tr> <tr> <td class="topAlign"><tt>QSystemTrayIcon.Critical</tt></td> <td class="topAlign"><tt>3</tt></td> <td class="topAlign">A critical warning icon is shown.</td> </tr> </table> <p><b>See also</b> <a href="qmessagebox.html">QMessageBox</a>.</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QSystemTrayIcon" />QSystemTrayIcon.__init__ (<i>self</i>, <a href="qobject.html">QObject</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a <a href="qsystemtrayicon.html">QSystemTrayIcon</a> object with the given <i>parent</i>.</p> <p>The icon is initially invisible.</p> <p><b>See also</b> <a href="qsystemtrayicon.html#visible-prop">visible</a>.</p> <h3 class="fn"><a name="QSystemTrayIcon-2" />QSystemTrayIcon.__init__ (<i>self</i>, <a href="qicon.html">QIcon</a> <i>icon</i>, <a href="qobject.html">QObject</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a <a href="qsystemtrayicon.html">QSystemTrayIcon</a> object with the given <i>icon</i> and <i>parent</i>.</p> <p>The icon is initially invisible.</p> <p><b>See also</b> <a href="qsystemtrayicon.html#visible-prop">visible</a>.</p> <h3 class="fn"><a name="contextMenu" /><a href="qmenu.html">QMenu</a> QSystemTrayIcon.contextMenu (<i>self</i>)</h3><p>Returns the current context menu for the system tray entry.</p> <p><b>See also</b> <a href="qsystemtrayicon.html#setContextMenu">setContextMenu</a>().</p> <h3 class="fn"><a name="event" />bool QSystemTrayIcon.event (<i>self</i>, <a href="qevent.html">QEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p> <h3 class="fn"><a name="geometry" /><a href="qrect.html">QRect</a> QSystemTrayIcon.geometry (<i>self</i>)</h3><p>Returns the geometry of the system tray icon in screen coordinates.</p> <p>This function was introduced in Qt 4.3.</p> <p><b>See also</b> <a href="qsystemtrayicon.html#visible-prop">visible</a>.</p> <h3 class="fn"><a name="hide" />QSystemTrayIcon.hide (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void hide()</tt>.</p><p>Hides the system tray entry.</p> <p><b>See also</b> <a href="qsystemtrayicon.html#show">show</a>() and <a href="qsystemtrayicon.html#visible-prop">visible</a>.</p> <h3 class="fn"><a name="icon" /><a href="qicon.html">QIcon</a> QSystemTrayIcon.icon (<i>self</i>)</h3><h3 class="fn"><a name="isSystemTrayAvailable" />bool QSystemTrayIcon.isSystemTrayAvailable ()</h3><p>Returns true if the system tray is available; otherwise returns false.</p> <p>If the system tray is currently unavailable but becomes available later, <a href="qsystemtrayicon.html">QSystemTrayIcon</a> will automatically add an entry in the system tray if it is <a href="qsystemtrayicon.html#visible-prop">visible</a>.</p> <h3 class="fn"><a name="isVisible" />bool QSystemTrayIcon.isVisible (<i>self</i>)</h3><h3 class="fn"><a name="setContextMenu" />QSystemTrayIcon.setContextMenu (<i>self</i>, <a href="qmenu.html">QMenu</a> <i>menu</i>)</h3><p>Sets the specified <i>menu</i> to be the context menu for the system tray icon.</p> <p>The menu will pop up when the user requests the context menu for the system tray icon by clicking the mouse button.</p> <p>On Mac OS X, this is currenly converted to a NSMenu, so the aboutToHide() signal is not emitted.</p> <p><b>Note:</b> 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.</p> <p><b>See also</b> <a href="qsystemtrayicon.html#contextMenu">contextMenu</a>().</p> <h3 class="fn"><a name="setIcon" />QSystemTrayIcon.setIcon (<i>self</i>, <a href="qicon.html">QIcon</a> <i>icon</i>)</h3><h3 class="fn"><a name="setToolTip" />QSystemTrayIcon.setToolTip (<i>self</i>, QString <i>tip</i>)</h3><h3 class="fn"><a name="setVisible" />QSystemTrayIcon.setVisible (<i>self</i>, bool <i>visible</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void setVisible(bool)</tt>.</p><h3 class="fn"><a name="show" />QSystemTrayIcon.show (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void show()</tt>.</p><p>Shows the icon in the system tray.</p> <p><b>See also</b> <a href="qsystemtrayicon.html#hide">hide</a>() and <a href="qsystemtrayicon.html#visible-prop">visible</a>.</p> <h3 class="fn"><a name="showMessage" />QSystemTrayIcon.showMessage (<i>self</i>, QString <i>title</i>, QString <i>msg</i>, <a href="qsystemtrayicon.html#MessageIcon-enum">MessageIcon</a> <i>icon</i> = QSystemTrayIcon.Information, int <i>msecs</i> = 10000)</h3><p>Shows a balloon message for the entry with the given <i>title</i>, <i>message</i> and <i>icon</i> for the time specified in <i>millisecondsTimeoutHint</i>. <i>title</i> and <i>message</i> must be plain text strings.</p> <p>Message can be clicked by the user; the <a href="qsystemtrayicon.html#messageClicked">messageClicked</a>() signal will emitted when this occurs.</p> <p>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.</p> <p>On Windows, the <i>millisecondsTimeoutHint</i> is usually ignored by the system when the application has focus.</p> <p>On Mac OS X, the Growl notification system must be installed for this function to display messages.</p> <p>This function was introduced in Qt 4.3.</p> <p><b>See also</b> <a href="qsystemtrayicon.html#show">show</a>() and <a href="qsystemtrayicon.html#supportsMessages">supportsMessages</a>().</p> <h3 class="fn"><a name="supportsMessages" />bool QSystemTrayIcon.supportsMessages ()</h3><p>Returns true if the system tray supports balloon messages; otherwise returns false.</p> <p><b>See also</b> <a href="qsystemtrayicon.html#showMessage">showMessage</a>().</p> <h3 class="fn"><a name="toolTip" />QString QSystemTrayIcon.toolTip (<i>self</i>)</h3><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="activated" />void activated (QSystemTrayIcon::ActivationReason)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the user activates the system tray icon. <i>reason</i> specifies the reason for activation. <a href="qsystemtrayicon.html#ActivationReason-enum">QSystemTrayIcon.ActivationReason</a> enumerates the various reasons.</p> <p><b>See also</b> <a href="qsystemtrayicon.html#ActivationReason-enum">QSystemTrayIcon.ActivationReason</a>.</p> <h3 class="fn"><a name="messageClicked" />void messageClicked ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the message displayed using <a href="qsystemtrayicon.html#showMessage">showMessage</a>() was clicked by the user.</p> <p>Currently this signal is not sent on Mac OS X.</p> <p><b>Note:</b> We follow Microsoft Windows XP/Vista behavior, so the signal is also emitted when the user clicks on a tray icon with a balloon message displayed.</p> <p><b>See also</b> <a href="qsystemtrayicon.html#activated">activated</a>().</p> <address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>