[−][src]Struct qt_widgets::QSystemTrayIcon
The QSystemTrayIcon class provides an icon for an application in the system tray.
C++ 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:
- All supported versions of Windows.
- All window managers and independent tray implementations for X11 that implement the http://standards.freedesktop.org/systemtray-spec/systemtray-spec-0.2.html freedesktop.org XEmbed system tray specification.
- All X11 desktop environments that implement the D-Bus http://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/StatusNotifierItem specification, including recent versions of KDE and Unity.
- All supported versions of macOS.
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.
Methods
impl QSystemTrayIcon
[src]
pub fn slot_set_visible(&self) -> Receiver<(bool,)>
[src]
This property holds whether the system tray entry is visible
Returns a built-in Qt slot QSystemTrayIcon::setVisible
that can be passed to qt_core::Signal::connect
.
pub fn slot_show(&self) -> Receiver<()>
[src]
Shows the icon in the system tray.
Returns a built-in Qt slot QSystemTrayIcon::show
that can be passed to qt_core::Signal::connect
.
pub fn slot_hide(&self) -> Receiver<()>
[src]
Hides the system tray entry.
Returns a built-in Qt slot QSystemTrayIcon::hide
that can be passed to qt_core::Signal::connect
.
pub fn slot_show_message(
&self
) -> Receiver<(*const QString, *const QString, *const QIcon, c_int)>
[src]
&self
) -> Receiver<(*const QString, *const QString, *const QIcon, c_int)>
This function overloads showMessage().
Returns a built-in Qt slot QSystemTrayIcon::showMessage
that can be passed to qt_core::Signal::connect
.
This function overloads showMessage().
Shows a balloon message for the entry with the given title, message, and custom icon icon for the time specified in millisecondsTimeoutHint.
This function was introduced in Qt 5.9.
pub fn slot_show_message2(
&self
) -> Receiver<(*const QString, *const QString, MessageIcon, c_int)>
[src]
&self
) -> Receiver<(*const QString, *const QString, MessageIcon, c_int)>
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.
Returns a built-in Qt slot QSystemTrayIcon::showMessage
that can be passed to qt_core::Signal::connect
.
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 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.
Has been turned into a slot in Qt 5.2.
This function was introduced in Qt 4.3.
See also show() and supportsMessages().
pub fn activated(&self) -> Signal<(ActivationReason,)>
[src]
This signal is emitted when the user activates the system tray icon. reason specifies the reason for activation. QSystemTrayIcon::ActivationReason enumerates the various reasons.
Returns a built-in Qt signal QSystemTrayIcon::activated
that can be passed to qt_core::Signal::connect
.
This signal is emitted when the user activates the system tray icon. reason specifies the reason for activation. QSystemTrayIcon::ActivationReason enumerates the various reasons.
See also QSystemTrayIcon::ActivationReason.
pub fn message_clicked(&self) -> Signal<()>
[src]
This signal is emitted when the message displayed using showMessage() was clicked by the user.
Returns a built-in Qt signal QSystemTrayIcon::messageClicked
that can be passed to qt_core::Signal::connect
.
This signal is emitted when the message displayed using showMessage() was clicked by the user.
Currently this signal is not sent on macOS.
Note: 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.
See also activated().
pub unsafe fn context_menu(&self) -> QPtr<QMenu>
[src]
Returns the current context menu for the system tray entry.
Calls C++ function: QMenu* QSystemTrayIcon::contextMenu() const
.
Returns the current context menu for the system tray entry.
See also setContextMenu().
pub unsafe fn geometry(&self) -> CppBox<QRect>
[src]
Returns the geometry of the system tray icon in screen coordinates.
Calls C++ function: QRect QSystemTrayIcon::geometry() const
.
Returns the geometry of the system tray icon in screen coordinates.
This function was introduced in Qt 4.3.
See also visible.
pub unsafe fn hide(&self)
[src]
Hides the system tray entry.
Calls C++ function: [slot] void QSystemTrayIcon::hide()
.
pub unsafe fn icon(&self) -> CppBox<QIcon>
[src]
This property holds the system tray icon
Calls C++ function: QIcon QSystemTrayIcon::icon() const
.
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.
Access functions:
QIcon | icon() const |
void | setIcon(const QIcon &icon) |
pub unsafe fn is_system_tray_available() -> bool
[src]
Returns true
if the system tray is available; otherwise returns false
.
Calls C++ function: static bool QSystemTrayIcon::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.
pub unsafe fn is_visible(&self) -> bool
[src]
This property holds whether the system tray entry is visible
Calls C++ function: bool QSystemTrayIcon::isVisible() const
.
pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>
[src]
Calls C++ function: virtual const QMetaObject* QSystemTrayIcon::metaObject() const
.
pub unsafe fn from_q_object(
parent: impl CastInto<Ptr<QObject>>
) -> QBox<QSystemTrayIcon>
[src]
parent: impl CastInto<Ptr<QObject>>
) -> QBox<QSystemTrayIcon>
Constructs a QSystemTrayIcon object with the given parent.
Calls C++ function: [constructor] void QSystemTrayIcon::QSystemTrayIcon(QObject* parent = …)
.
Constructs a QSystemTrayIcon object with the given parent.
The icon is initially invisible.
See also visible.
pub unsafe fn from_q_icon_q_object(
icon: impl CastInto<Ref<QIcon>>,
parent: impl CastInto<Ptr<QObject>>
) -> QBox<QSystemTrayIcon>
[src]
icon: impl CastInto<Ref<QIcon>>,
parent: impl CastInto<Ptr<QObject>>
) -> QBox<QSystemTrayIcon>
Constructs a QSystemTrayIcon object with the given icon and parent.
Calls C++ function: [constructor] void QSystemTrayIcon::QSystemTrayIcon(const QIcon& icon, QObject* parent = …)
.
Constructs a QSystemTrayIcon object with the given icon and parent.
The icon is initially invisible.
See also visible.
pub unsafe fn new() -> QBox<QSystemTrayIcon>
[src]
The QSystemTrayIcon class provides an icon for an application in the system tray.
Calls C++ function: [constructor] void QSystemTrayIcon::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:
- All supported versions of Windows.
- All window managers and independent tray implementations for X11 that implement the http://standards.freedesktop.org/systemtray-spec/systemtray-spec-0.2.html freedesktop.org XEmbed system tray specification.
- All X11 desktop environments that implement the D-Bus http://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/StatusNotifierItem specification, including recent versions of KDE and Unity.
- All supported versions of macOS.
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.
pub unsafe fn from_q_icon(
icon: impl CastInto<Ref<QIcon>>
) -> QBox<QSystemTrayIcon>
[src]
icon: impl CastInto<Ref<QIcon>>
) -> QBox<QSystemTrayIcon>
Constructs a QSystemTrayIcon object with the given icon and parent.
Calls C++ function: [constructor] void QSystemTrayIcon::QSystemTrayIcon(const QIcon& icon)
.
Constructs a QSystemTrayIcon object with the given icon and parent.
The icon is initially invisible.
See also visible.
pub unsafe fn qt_metacall(
&self,
arg1: Call,
arg2: c_int,
arg3: *mut *mut c_void
) -> c_int
[src]
&self,
arg1: Call,
arg2: c_int,
arg3: *mut *mut c_void
) -> c_int
Calls C++ function: virtual int QSystemTrayIcon::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3)
.
pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void
[src]
Calls C++ function: virtual void* QSystemTrayIcon::qt_metacast(const char* arg1)
.
pub unsafe fn set_context_menu(&self, menu: impl CastInto<Ptr<QMenu>>)
[src]
Sets the specified menu to be the context menu for the system tray icon.
Calls C++ function: void QSystemTrayIcon::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 macOS, 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().
pub unsafe fn set_icon(&self, icon: impl CastInto<Ref<QIcon>>)
[src]
This property holds the system tray icon
Calls C++ function: void QSystemTrayIcon::setIcon(const QIcon& icon)
.
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.
Access functions:
QIcon | icon() const |
void | setIcon(const QIcon &icon) |
pub unsafe fn set_tool_tip(&self, tip: impl CastInto<Ref<QString>>)
[src]
This property holds the tooltip for the system tray entry
Calls C++ function: void QSystemTrayIcon::setToolTip(const QString& tip)
.
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.
Access functions:
QString | toolTip() const |
void | setToolTip(const QString &tip) |
pub unsafe fn set_visible(&self, visible: bool)
[src]
This property holds whether the system tray entry is visible
Calls C++ function: [slot] void QSystemTrayIcon::setVisible(bool visible)
.
pub unsafe fn show(&self)
[src]
Shows the icon in the system tray.
Calls C++ function: [slot] void QSystemTrayIcon::show()
.
pub unsafe fn show_message_2_q_string_q_icon_int(
&self,
title: impl CastInto<Ref<QString>>,
msg: impl CastInto<Ref<QString>>,
icon: impl CastInto<Ref<QIcon>>,
msecs: c_int
)
[src]
&self,
title: impl CastInto<Ref<QString>>,
msg: impl CastInto<Ref<QString>>,
icon: impl CastInto<Ref<QIcon>>,
msecs: c_int
)
This function overloads showMessage().
Calls C++ function: [slot] void QSystemTrayIcon::showMessage(const QString& title, const QString& msg, const QIcon& icon, int msecs = …)
.
This function overloads showMessage().
Shows a balloon message for the entry with the given title, message, and custom icon icon for the time specified in millisecondsTimeoutHint.
This function was introduced in Qt 5.9.
pub unsafe fn show_message_2_q_string_message_icon_int(
&self,
title: impl CastInto<Ref<QString>>,
msg: impl CastInto<Ref<QString>>,
icon: MessageIcon,
msecs: c_int
)
[src]
&self,
title: impl CastInto<Ref<QString>>,
msg: impl CastInto<Ref<QString>>,
icon: MessageIcon,
msecs: c_int
)
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.
Calls C++ function: [slot] void QSystemTrayIcon::showMessage(const QString& title, const QString& msg, QSystemTrayIcon::MessageIcon icon = …, int msecs = …)
.
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 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.
Has been turned into a slot in Qt 5.2.
This function was introduced in Qt 4.3.
See also show() and supportsMessages().
pub unsafe fn show_message_2_q_string_q_icon(
&self,
title: impl CastInto<Ref<QString>>,
msg: impl CastInto<Ref<QString>>,
icon: impl CastInto<Ref<QIcon>>
)
[src]
&self,
title: impl CastInto<Ref<QString>>,
msg: impl CastInto<Ref<QString>>,
icon: impl CastInto<Ref<QIcon>>
)
This function overloads showMessage().
Calls C++ function: [slot] void QSystemTrayIcon::showMessage(const QString& title, const QString& msg, const QIcon& icon)
.
This function overloads showMessage().
Shows a balloon message for the entry with the given title, message, and custom icon icon for the time specified in millisecondsTimeoutHint.
This function was introduced in Qt 5.9.
pub unsafe fn show_message_2_q_string_message_icon(
&self,
title: impl CastInto<Ref<QString>>,
msg: impl CastInto<Ref<QString>>,
icon: MessageIcon
)
[src]
&self,
title: impl CastInto<Ref<QString>>,
msg: impl CastInto<Ref<QString>>,
icon: MessageIcon
)
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.
Calls C++ function: [slot] void QSystemTrayIcon::showMessage(const QString& title, const QString& msg, QSystemTrayIcon::MessageIcon icon = …)
.
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 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.
Has been turned into a slot in Qt 5.2.
This function was introduced in Qt 4.3.
See also show() and supportsMessages().
pub unsafe fn show_message_2_q_string(
&self,
title: impl CastInto<Ref<QString>>,
msg: impl CastInto<Ref<QString>>
)
[src]
&self,
title: impl CastInto<Ref<QString>>,
msg: impl CastInto<Ref<QString>>
)
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.
Calls C++ function: [slot] void QSystemTrayIcon::showMessage(const QString& title, const QString& msg)
.
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 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.
Has been turned into a slot in Qt 5.2.
This function was introduced in Qt 4.3.
See also show() and supportsMessages().
pub unsafe fn static_meta_object() -> Ref<QMetaObject>
[src]
Returns a reference to the staticMetaObject
field.
pub unsafe fn supports_messages() -> bool
[src]
Returns true
if the system tray supports balloon messages; otherwise returns false
.
Calls C++ function: static bool QSystemTrayIcon::supportsMessages()
.
Returns true
if the system tray supports balloon messages; otherwise returns false
.
See also showMessage().
pub unsafe fn tool_tip(&self) -> CppBox<QString>
[src]
This property holds the tooltip for the system tray entry
Calls C++ function: QString QSystemTrayIcon::toolTip() const
.
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.
Access functions:
QString | toolTip() const |
void | setToolTip(const QString &tip) |
pub unsafe fn tr(
s: *const c_char,
c: *const c_char,
n: c_int
) -> CppBox<QString>
[src]
s: *const c_char,
c: *const c_char,
n: c_int
) -> CppBox<QString>
Calls C++ function: static QString QSystemTrayIcon::tr(const char* s, const char* c, int n)
.
pub unsafe fn tr_utf8(
s: *const c_char,
c: *const c_char,
n: c_int
) -> CppBox<QString>
[src]
s: *const c_char,
c: *const c_char,
n: c_int
) -> CppBox<QString>
Calls C++ function: static QString QSystemTrayIcon::trUtf8(const char* s, const char* c, int n)
.
Trait Implementations
impl CppDeletable for QSystemTrayIcon
[src]
unsafe fn delete(&self)
[src]
Removes the icon from the system tray and frees all allocated resources.
Calls C++ function: virtual [destructor] void QSystemTrayIcon::~QSystemTrayIcon()
.
Removes the icon from the system tray and frees all allocated resources.
impl Deref for QSystemTrayIcon
[src]
type Target = QObject
The resulting type after dereferencing.
fn deref(&self) -> &QObject
[src]
Calls C++ function: QObject* static_cast<QObject*>(QSystemTrayIcon* ptr)
.
impl DynamicCast<QSystemTrayIcon> for QObject
[src]
unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QSystemTrayIcon>
[src]
Calls C++ function: QSystemTrayIcon* dynamic_cast<QSystemTrayIcon*>(QObject* ptr)
.
impl StaticDowncast<QSystemTrayIcon> for QObject
[src]
unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QSystemTrayIcon>
[src]
Calls C++ function: QSystemTrayIcon* static_cast<QSystemTrayIcon*>(QObject* ptr)
.
impl StaticUpcast<QObject> for QSystemTrayIcon
[src]
unsafe fn static_upcast(ptr: Ptr<QSystemTrayIcon>) -> Ptr<QObject>
[src]
Calls C++ function: QObject* static_cast<QObject*>(QSystemTrayIcon* ptr)
.
Auto Trait Implementations
impl RefUnwindSafe for QSystemTrayIcon
impl Send for QSystemTrayIcon
impl Sync for QSystemTrayIcon
impl Unpin for QSystemTrayIcon
impl UnwindSafe for QSystemTrayIcon
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> CastInto<U> for T where
U: CastFrom<T>,
[src]
U: CastFrom<T>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> StaticUpcast<T> for T
[src]
unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,