QPlatformSystemTrayIcon Class

The QPlatformSystemTrayIcon class abstracts the system tray icon and interaction. More...

Header: #include <QPlatformSystemTrayIcon>
qmake: QT += gui
Inherits: QObject

Public Types

enum ActivationReason { Unknown, Context, DoubleClick, Trigger, MiddleClick }
enum MessageIcon { NoIcon, Information, Warning, Critical }

Public Functions

virtual void cleanup() = 0
virtual QPlatformMenu * createMenu() const
virtual QRect geometry() const = 0
virtual void init() = 0
virtual bool isSystemTrayAvailable() const = 0
virtual void showMessage(const QString & title, const QString & msg, const QIcon & icon, MessageIcon iconType, int msecs) = 0
virtual bool supportsMessages() const = 0
virtual void updateIcon(const QIcon & icon) = 0
virtual void updateMenu(QPlatformMenu * menu) = 0
virtual void updateToolTip(const QString & tooltip) = 0
  • 31 public functions inherited from QObject


void activated(QPlatformSystemTrayIcon::ActivationReason reason)
void messageClicked()

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 11 static public members inherited from QObject
  • 9 protected functions inherited from QObject

Detailed Description

The QPlatformSystemTrayIcon class abstracts the system tray icon and interaction.

See also QSystemTrayIcon.

Member Type Documentation

enum QPlatformSystemTrayIcon::ActivationReason

This enum describes the reason the system tray was activated.

QPlatformSystemTrayIcon::Unknown0Unknown reason
QPlatformSystemTrayIcon::Context1The context menu for the system tray entry was requested
QPlatformSystemTrayIcon::DoubleClick2The system tray entry was double clicked
QPlatformSystemTrayIcon::Trigger3The system tray entry was clicked
QPlatformSystemTrayIcon::MiddleClick4The system tray entry was clicked with the middle mouse button

See also activated().

enum QPlatformSystemTrayIcon::MessageIcon

This enum describes the icon that is shown when a balloon message is displayed.

QPlatformSystemTrayIcon::NoIcon0No icon is shown.
QPlatformSystemTrayIcon::Information1An information icon is shown.
QPlatformSystemTrayIcon::Warning2A standard warning icon is shown.
QPlatformSystemTrayIcon::Critical3A critical warning icon is shown.

See also updateIcon(), showMessage(), and QMessageBox.

Member Function Documentation

[signal] void QPlatformSystemTrayIcon::activated(QPlatformSystemTrayIcon::ActivationReason reason)

This signal is emitted when the user activates the system tray icon. reason specifies the reason for activation.

See also QSystemTrayIcon::ActivationReason.

[pure virtual] void QPlatformSystemTrayIcon::cleanup()

This method is called to cleanup the platform dependent implementation.

[virtual] QPlatformMenu * QPlatformSystemTrayIcon::createMenu() const

This method is called in case there is no QPlatformMenu available when updating the menu. This allows the abstraction to provide a menu for the system tray icon even if normally a non-native menu is used.

The default implementation returns a null pointer.

This function was introduced in Qt 5.3.

See also updateMenu().

[pure virtual] QRect QPlatformSystemTrayIcon::geometry() const

This method returns the geometry of the platform dependent system tray icon on the screen.

[pure virtual] void QPlatformSystemTrayIcon::init()

This method is called to initialize the platform dependent implementation.

[pure virtual] bool QPlatformSystemTrayIcon::isSystemTrayAvailable() const

Returns true if the system tray is available on the platform.

[signal] void QPlatformSystemTrayIcon::messageClicked()

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

See also activated().

[pure virtual] void QPlatformSystemTrayIcon::showMessage(const QString & title, const QString & msg, const QIcon & icon, MessageIcon iconType, int msecs)

Shows a balloon message for the entry with the given title, message msg and icon for the time specified in msecs. iconType is used as a hint for the implementing platform.

See also QSystemTrayIcon::showMessage().

[pure virtual] bool QPlatformSystemTrayIcon::supportsMessages() const

Returns true if the system tray supports messages on the platform.

[pure virtual] void QPlatformSystemTrayIcon::updateIcon(const QIcon & icon)

This method is called when the icon did change.

[pure virtual] void QPlatformSystemTrayIcon::updateMenu(QPlatformMenu * menu)

This method is called when the system tray menu did change.

[pure virtual] void QPlatformSystemTrayIcon::updateToolTip(const QString & tooltip)

This method is called when the tooltip text did change.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.