|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QObject
com.trolltech.qt.gui.QSystemTrayIcon
public class QSystemTrayIcon
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:
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.
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.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 |
---|
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.
public final QSignalEmitter.Signal0 messageClicked
This signal is emitted when the message displayed using showMessage was clicked by the user.
Constructor Detail |
---|
public QSystemTrayIcon()
Equivalent to QSystemTrayIcon(0).
public QSystemTrayIcon(QObject parent)
Constructs a QSystemTrayIcon object with the given parent.
The icon is initially invisible.
visible
public QSystemTrayIcon(QIcon icon)
Equivalent to QSystemTrayIcon(icon, 0).
public QSystemTrayIcon(QIcon icon, QObject parent)
Constructs a QSystemTrayIcon object with the given icon and parent.
The icon is initially invisible.
visible
Method Detail |
---|
public final QMenu contextMenu()
Returns the current context menu for the system tray entry.
public final QRect geometry()
Returns the geometry of the system tray icon in screen coordinates.
visible
public final void hide()
Hides the system tray entry.
visible
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.
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.
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.
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.
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.
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.
public final void show()
Shows the icon in the system tray.
visible
public final void showMessage(java.lang.String title, java.lang.String msg, QSystemTrayIcon.MessageIcon icon)
Equivalent to showMessage(title, msg, icon, 10000).
public final void showMessage(java.lang.String title, java.lang.String msg)
Equivalent to showMessage(title, msg, Information, 10000).
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.
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.
public boolean event(QEvent event)
This function is reimplemented for internal reasons.
event
in class QObject
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.
public static boolean supportsMessages()
Returns true if the system tray supports balloon messages; otherwise returns false.
public static QSystemTrayIcon fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |