Sophie

Sophie

distrib > CentOS > 5 > x86_64 > by-pkgid > ac91357d6caede925de099a02fced14e > files > 4787

qt4-doc-4.2.1-1.el5_7.1.x86_64.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /tmp/qt-4.2.1-harald-1161357942206/qt-x11-opensource-src-4.2.1/src/gui/util/qsystemtrayicon.cpp -->
<head>
  <title>Qt 4.2: QSystemTrayIcon Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></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>
<pre> #include &lt;QSystemTrayIcon&gt;</pre><p>Inherits <a href="qobject.html">QObject</a>.</p>
<p>This class was introduced in Qt 4.2.</p>
<ul>
<li><a href="qsystemtrayicon-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h3>Public 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>
<a name="properties"></a>
<h3>Properties</h3>
<ul>
<li><div class="fn"/><b><a href="qsystemtrayicon.html#icon-prop">icon</a></b> : QIcon</li>
<li><div class="fn"/><b><a href="qsystemtrayicon.html#toolTip-prop">toolTip</a></b> : QString</li>
<li><div class="fn"/><b><a href="qsystemtrayicon.html#visible-prop">visible</a></b> : bool</li>
</ul>
<ul>
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="qsystemtrayicon.html#QSystemTrayIcon">QSystemTrayIcon</a></b> ( QObject * <i>parent</i> = 0 )</li>
<li><div class="fn"/><b><a href="qsystemtrayicon.html#QSystemTrayIcon-2">QSystemTrayIcon</a></b> ( const QIcon &amp; <i>icon</i>, QObject * <i>parent</i> = 0 )</li>
<li><div class="fn"/><b><a href="qsystemtrayicon.html#dtor.QSystemTrayIcon">~QSystemTrayIcon</a></b> ()</li>
<li><div class="fn"/>QMenu * <b><a href="qsystemtrayicon.html#contextMenu">contextMenu</a></b> () const</li>
<li><div class="fn"/>QIcon <b><a href="qsystemtrayicon.html#icon-prop">icon</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qsystemtrayicon.html#visible-prop">isVisible</a></b> () const</li>
<li><div class="fn"/>void <b><a href="qsystemtrayicon.html#setContextMenu">setContextMenu</a></b> ( QMenu * <i>menu</i> )</li>
<li><div class="fn"/>void <b><a href="qsystemtrayicon.html#icon-prop">setIcon</a></b> ( const QIcon &amp; <i>icon</i> )</li>
<li><div class="fn"/>void <b><a href="qsystemtrayicon.html#toolTip-prop">setToolTip</a></b> ( const QString &amp; <i>tip</i> )</li>
<li><div class="fn"/>void <b><a href="qsystemtrayicon.html#showMessage">showMessage</a></b> ( const QString &amp; <i>title</i>, const QString &amp; <i>message</i>, MessageIcon <i>icon</i> = Information, int <i>milliseconds</i> = 10000 )</li>
<li><div class="fn"/>QString <b><a href="qsystemtrayicon.html#toolTip-prop">toolTip</a></b> () const</li>
</ul>
<ul>
<li><div class="fn"/>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<a name="public-slots"></a>
<h3>Public Slots</h3>
<ul>
<li><div class="fn"/>void <b><a href="qsystemtrayicon.html#hide">hide</a></b> ()</li>
<li><div class="fn"/>void <b><a href="qsystemtrayicon.html#visible-prop">setVisible</a></b> ( bool <i>visible</i> )</li>
<li><div class="fn"/>void <b><a href="qsystemtrayicon.html#show">show</a></b> ()</li>
</ul>
<ul>
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
</ul>
<a name="signals"></a>
<h3>Signals</h3>
<ul>
<li><div class="fn"/>void <b><a href="qsystemtrayicon.html#activated">activated</a></b> ( QSystemTrayIcon::ActivationReason <i>reason</i> )</li>
<li><div class="fn"/>void <b><a href="qsystemtrayicon.html#messageClicked">messageClicked</a></b> ()</li>
</ul>
<ul>
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
</ul>
<a name="static-public-members"></a>
<h3>Static Public Members</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>
<ul>
<li><div class="fn"/>5 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="details"></a>
<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 align="center"><img src="images/system-tray.png" alt="The system tray on Windows XP." /></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>Mac OS X, with the exception of <a href="qsystemtrayicon.html#showMessage">showMessage</a>()</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 (&quot;balloon messages&quot;) 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>. This is not supported on any other platform.</p>
<p>See also <a href="qdesktopservices.html">QDesktopServices</a>, <a href="qdesktopwidget.html">QDesktopWidget</a>, and <a href="desktop-integration.html">Desktop Integration</a>.</p>
<hr />
<h2>Member Type Documentation</h2>
<h3 class="fn"><a name="ActivationReason-enum"></a>enum QSystemTrayIcon::ActivationReason</h3>
<p>This enum describes the reason the system tray was activated.</p>
<p><table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QSystemTrayIcon::Unknown</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">Unknown reason</td></tr>
<tr><td valign="top"><tt>QSystemTrayIcon::Context</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">The context menu for the system tray entry was requested</td></tr>
<tr><td valign="top"><tt>QSystemTrayIcon::DoubleClick</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">The system tray entry was double clicked</td></tr>
<tr><td valign="top"><tt>QSystemTrayIcon::Trigger</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">The system tray entry was clicked</td></tr>
<tr><td valign="top"><tt>QSystemTrayIcon::MiddleClick</tt></td><td align="center" valign="top"><tt>4</tt></td><td valign="top">The system tray entry was clicked with the middle mouse button</td></tr>
</table></p>
<p>See also <a href="qsystemtrayicon.html#activated">activated</a>().</p>
<h3 class="fn"><a name="MessageIcon-enum"></a>enum QSystemTrayIcon::MessageIcon</h3>
<p>This enum describes the icon that is shown when a balloon message is displayed.</p>
<p><table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QSystemTrayIcon::NoIcon</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">No icon is shown.</td></tr>
<tr><td valign="top"><tt>QSystemTrayIcon::Information</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">An information icon is shown.</td></tr>
<tr><td valign="top"><tt>QSystemTrayIcon::Warning</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">A standard warning icon is shown.</td></tr>
<tr><td valign="top"><tt>QSystemTrayIcon::Critical</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">A critical warning icon is shown.</td></tr>
</table></p>
<p>See also <a href="qmessagebox.html">QMessageBox</a>.</p>
<hr />
<h2>Property Documentation</h2>
<h3 class="fn"><a name="icon-prop"></a>icon : <a href="qicon.html">QIcon</a></h3>
<p>This property holds the system tray icon.</p>
<p>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.</p>
<p>On X11, due to a limitation in the system tray specification, mouse clicks on transparent areas in the icon are propagated to the system tray. If this behavior is unacceptable, we suggest using an icon with no transparency.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>QIcon icon () const</b></li>
<li><div class="fn"/><b>void setIcon ( const QIcon &amp; <i>icon</i> )</b></li>
</ul>
<h3 class="fn"><a name="toolTip-prop"></a>toolTip : <a href="qstring.html">QString</a></h3>
<p>This property holds the tooltip for the system tray entry.</p>
<p>On some systems, the tooltip's length is limited. The tooltip will be truncated if necessary.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>QString toolTip () const</b></li>
<li><div class="fn"/><b>void setToolTip ( const QString &amp; <i>tip</i> )</b></li>
</ul>
<h3 class="fn"><a name="visible-prop"></a>visible : bool</h3>
<p>This property holds whether the system tray entry is visible.</p>
<p>Setting this property to true or calling <a href="qsystemtrayicon.html#show">show</a>() makes the system tray icon visible; setting this property to false or calling <a href="qsystemtrayicon.html#hide">hide</a>() hides it.</p>
<p>Access functions:</p>
<ul>
<li><div class="fn"/><b>bool isVisible () const</b></li>
<li><div class="fn"/><b>void setVisible ( bool <i>visible</i> )</b></li>
</ul>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QSystemTrayIcon"></a>QSystemTrayIcon::QSystemTrayIcon ( <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
<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>See also <a href="qsystemtrayicon.html#visible-prop">visible</a>.</p>
<h3 class="fn"><a name="QSystemTrayIcon-2"></a>QSystemTrayIcon::QSystemTrayIcon ( const <a href="qicon.html">QIcon</a> &amp; <i>icon</i>, <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
<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>See also <a href="qsystemtrayicon.html#visible-prop">visible</a>.</p>
<h3 class="fn"><a name="dtor.QSystemTrayIcon"></a>QSystemTrayIcon::~QSystemTrayIcon ()</h3>
<p>Removes the icon from the system tray and frees all allocated resources.</p>
<h3 class="fn"><a name="activated"></a>void QSystemTrayIcon::activated ( <a href="qsystemtrayicon.html#ActivationReason-enum">QSystemTrayIcon::ActivationReason</a> <i>reason</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
<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>See also <a href="qsystemtrayicon.html#ActivationReason-enum">QSystemTrayIcon::ActivationReason</a>.</p>
<h3 class="fn"><a name="contextMenu"></a><a href="qmenu.html">QMenu</a> * QSystemTrayIcon::contextMenu () const</h3>
<p>Returns the current context menu for the system tray entry.</p>
<p>See also <a href="qsystemtrayicon.html#setContextMenu">setContextMenu</a>().</p>
<h3 class="fn"><a name="hide"></a>void QSystemTrayIcon::hide ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
<p>Hides the system tray entry.</p>
<p>See also <a href="qsystemtrayicon.html#show">show</a>() and <a href="qsystemtrayicon.html#visible-prop">visible</a>.</p>
<h3 class="fn"><a name="isSystemTrayAvailable"></a>bool QSystemTrayIcon::isSystemTrayAvailable ()&nbsp;&nbsp;<tt> [static]</tt></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="messageClicked"></a>void QSystemTrayIcon::messageClicked ()&nbsp;&nbsp;<tt> [signal]</tt></h3>
<p>This signal is emitted when the message displayed using <a href="qsystemtrayicon.html#showMessage">showMessage</a>() was clicked by the user.</p>
<p>See also <a href="qsystemtrayicon.html#activated">activated</a>().</p>
<h3 class="fn"><a name="setContextMenu"></a>void QSystemTrayIcon::setContextMenu ( <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>See also <a href="qsystemtrayicon.html#contextMenu">contextMenu</a>().</p>
<h3 class="fn"><a name="show"></a>void QSystemTrayIcon::show ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
<p>Shows the icon in the system tray.</p>
<p>See also <a href="qsystemtrayicon.html#hide">hide</a>() and <a href="qsystemtrayicon.html#visible-prop">visible</a>.</p>
<h3 class="fn"><a name="showMessage"></a>void QSystemTrayIcon::showMessage ( const <a href="qstring.html">QString</a> &amp; <i>title</i>, const <a href="qstring.html">QString</a> &amp; <i>message</i>, <a href="qsystemtrayicon.html#MessageIcon-enum">MessageIcon</a> <i>icon</i> = Information, int <i>milliseconds</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>milliseconds</i>.</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>See also <a href="qsystemtrayicon.html#show">show</a>() and <a href="qsystemtrayicon.html#supportsMessages">supportsMessages</a>().</p>
<h3 class="fn"><a name="supportsMessages"></a>bool QSystemTrayIcon::supportsMessages ()&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Returns true if the system tray supports balloon messages; otherwise returns false.</p>
<p>Mac OS X does not support ballon messages currently.</p>
<p>See also <a href="qsystemtrayicon.html#showMessage">showMessage</a>().</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2006 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.2.1</div></td>
</tr></table></div></address></body>
</html>