Overview | Package | Class | Tree | Deprecated | Index | Help
Qt Jambi Home |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QSystemTrayIcon

    java.lang.Object
      com.trolltech.qt.QSignalEmitter
          com.trolltech.qt.QtJambiObject
              com.trolltech.qt.core.QObject
                  com.trolltech.qt.gui.QSystemTrayIcon

All Implemented Interfaces:
  QtJambiInterface

    public class QSystemTrayIcon

extends QObject

The `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 `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 version of Mac OS X. QSystemTrayIcon::showMessage() requires Growl 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 `QSystemTrayIcon` object, call `setContextMenu` to provide a context menu for the icon, and call `show` to make it visible in the system tray. Status notification messages ("balloon messages") can be displayed at any time using `showMessage`.

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 visible.

The `activated` signal is emitted when the user activates the icon.

Only on X11, when a tooltip is requested, the `QSystemTrayIcon` receives a `QHelpEvent` of type QEvent::ToolTip. Additionally, the `QSystemTrayIcon` receives wheel events of type QEvent::Wheel. These are not supported on any other platform.

See Also:
  `QDesktopServices`, `QDesktopWidget`, Desktop Integration, System Tray Icon Example

Nested Class Summary
`static class` | `QSystemTrayIcon.ActivationReason` This enum describes the reason the system tray was activated.
`static class` | `QSystemTrayIcon.MessageIcon` This enum describes the icon that is shown when a balloon message is displayed.

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>`

Field Summary
`QSignalEmitter.Signal1<QSystemTrayIcon.ActivationReason>` | `activated` This signal is emitted when the user activates the system tray icon.
`QSignalEmitter.Signal0` | `messageClicked` This signal is emitted when the message displayed using `showMessage` was clicked by the user.

Constructor Summary
`QSystemTrayIcon()` Equivalent to `QSystemTrayIcon`(0).
`QSystemTrayIcon(QIcon icon)` Equivalent to `QSystemTrayIcon`(`icon`, 0).
`QSystemTrayIcon(QIcon icon, QObject parent)` Constructs a `QSystemTrayIcon` object with the given `icon` and `parent`.
`QSystemTrayIcon(QObject parent)` Constructs a `QSystemTrayIcon` object with the given `parent`.

Method Summary
`QMenu` | `contextMenu()` Returns the current context menu for the system tray entry.
`boolean` | `event(QEvent event)` This function is reimplemented for internal reasons.
`static QSystemTrayIcon` | `fromNativePointer(QNativePointer nativePointer)` This function returns the QSystemTrayIcon instance pointed to by nativePointer
`QRect` | `geometry()` Returns the geometry of the system tray icon in screen coordinates.
`void` | `hide()` Hides the system tray entry.
`QIcon` | `icon()` Returns the system tray icon.
`static boolean` | `isSystemTrayAvailable()` Returns true if the system tray is available; otherwise returns false.
`boolean` | `isVisible()` Returns whether the system tray entry is visible.
`void` | `setContextMenu(QMenu menu)` Sets the specified `menu` to be the context menu for the system tray icon.
`void` | `setIcon(QIcon icon)` Sets the system tray icon to `icon`.
`void` | `setToolTip(java.lang.String tip)` Sets the tooltip for the system tray entry to `tip`.
`void` | `setVisible(boolean visible)` Sets whether the system tray entry is visible to `visible`.
`void` | `show()` Shows the icon in the system tray.
`void` | `showMessage(java.lang.String title, java.lang.String msg)` Equivalent to `showMessage`(`title`, `msg`, Information, 10000).
`void` | `showMessage(java.lang.String title, java.lang.String msg, QSystemTrayIcon.MessageIcon icon)` Equivalent to `showMessage`(`title`, `msg`, `icon`, 10000).
`void` | `showMessage(java.lang.String title, java.lang.String msg, QSystemTrayIcon.MessageIcon icon, int msecs)` Shows a balloon message for the entry with the given `title`, `msg` and `icon` for the time specified in `msecs`.
`static boolean` | `supportsMessages()` Returns true if the system tray supports balloon messages; otherwise returns false.
`java.lang.String` | `toolTip()` Returns the tooltip for the system tray entry.

Methods inherited from class com.trolltech.qt.core.QObject
`blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent`

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`disconnect, disconnect, signalSender`

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Field Detail

### activated

    public final QSignalEmitter.Signal1<QSystemTrayIcon.ActivationReason> activated

  This signal is emitted when the user activates the system tray icon. `reason` specifies the reason for activation. QSystemTrayIcon::ActivationReason enumerates the various reasons.

  Compatible Slot Signatures:
    `void mySlot(com.trolltech.qt.gui.QSystemTrayIcon.ActivationReason reason)`
    `void mySlot()`
  See Also:
    `QSystemTrayIcon::ActivationReason`

### messageClicked

    public final QSignalEmitter.Signal0 messageClicked

  This signal is emitted when the message displayed using `showMessage` was clicked by the user.

  Compatible Slot Signature:
    `void mySlot()`
  See Also:
    `activated`

Constructor Detail

### QSystemTrayIcon

    public QSystemTrayIcon()

  Equivalent to `QSystemTrayIcon`(0).

### QSystemTrayIcon

    public QSystemTrayIcon(QObject parent)

  Constructs a `QSystemTrayIcon` object with the given `parent`.

  The icon is initially invisible.

  See Also:
    `visible`

### QSystemTrayIcon

    public QSystemTrayIcon(QIcon icon)

  Equivalent to `QSystemTrayIcon`(`icon`, 0).

### QSystemTrayIcon

    public QSystemTrayIcon(QIcon icon,
                           QObject parent)

  Constructs a `QSystemTrayIcon` object with the given `icon` and `parent`.

  The icon is initially invisible.

  See Also:
    `visible`

Method Detail

### contextMenu

    public final QMenu contextMenu()

  Returns the current context menu for the system tray entry.

  See Also:
    `setContextMenu`

### geometry

    public final QRect geometry()

  Returns the geometry of the system tray icon in screen coordinates.

  See Also:
    `visible`

### hide

    public final void hide()

  Hides the system tray entry.

  See Also:
    `show`, `visible`

### icon

    public final QIcon icon()

  Returns 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.

  See Also:
    `setIcon`

### isVisible

    public final boolean isVisible()

  Returns whether the system tray entry is visible.

  Setting this property to true or calling `show` makes the system tray icon visible; setting this property to false or calling `hide` hides it.

### setContextMenu

    public final void setContextMenu(QMenu menu)

  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.

  See Also:
    `contextMenu`

### setIcon

    public final void setIcon(QIcon icon)

  Sets the system tray icon to `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.

  See Also:
    `icon`

### setToolTip

    public final void setToolTip(java.lang.String tip)

  Sets the tooltip for the system tray entry to `tip`.

  On some systems, the tooltip's length is limited. The tooltip will be truncated if necessary.

  See Also:
    `toolTip`

### setVisible

    public final void setVisible(boolean visible)

  Sets whether the system tray entry is visible to `visible`.

  Setting this property to true or calling `show` makes the system tray icon visible; setting this property to false or calling `hide` hides it.

  See Also:
    `isVisible`

### show

    public final void show()

  Shows the icon in the system tray.

  See Also:
    `hide`, `visible`

### showMessage

    public final void showMessage(java.lang.String title,
                                  java.lang.String msg,
                                  QSystemTrayIcon.MessageIcon icon)

  Equivalent to `showMessage`(`title`, `msg`, `icon`, 10000).

### showMessage

    public final void showMessage(java.lang.String title,
                                  java.lang.String msg)

  Equivalent to `showMessage`(`title`, `msg`, Information, 10000).

### showMessage

    public final void showMessage(java.lang.String title,
                                  java.lang.String msg,
                                  QSystemTrayIcon.MessageIcon icon,
                                  int msecs)

  Shows a balloon message for the entry with the given `title`, `msg` and `icon` for the time specified in `msecs`.

  Message can be clicked by the user; the `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 `msecs` is usually ignored by the system when the application has focus.

  See Also:
    `show`, `supportsMessages`

### toolTip

    public final java.lang.String toolTip()

  Returns the tooltip for the system tray entry.

  On some systems, the tooltip's length is limited. The tooltip will be truncated if necessary.

  See Also:
    `setToolTip`

### event

    public boolean event(QEvent event)

  This function is reimplemented for internal reasons.

  Overrides:
    `event` in class `QObject`
  See Also:
    `installEventFilter`, `timerEvent`, `QApplication::sendEvent`, `QApplication::postEvent`, `QWidget::event`

### isSystemTrayAvailable

    public static boolean isSystemTrayAvailable()

  Returns true if the system tray is available; otherwise returns false.

  If the system tray is currently unavailable but becomes available later, `QSystemTrayIcon` will automatically add an entry in the system tray if it is visible.

### supportsMessages

    public static boolean supportsMessages()

  Returns true if the system tray supports balloon messages; otherwise returns false.

  See Also:
    `showMessage`

### fromNativePointer

    public static QSystemTrayIcon fromNativePointer(QNativePointer nativePointer)

  This function returns the QSystemTrayIcon instance pointed to by nativePointer

  Parameters:
    `nativePointer` - the QNativePointer of which object should be returned.

Overview | Package | Class | Tree | Deprecated | Index | Help
Qt Jambi Home |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD