Detailed Description
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 versions of Mac OS X. Note that the Growl notification system must be installed for QSystemTrayIcon::showMessage() 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 callshow() to make it visible in the system tray. Status notification messages ("balloon messages") can be displayed at any time usingshowMessage().
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, and System Tray Icon Example.
实例:
m_pIcon = new QSystemTrayIcon();
m_pIcon->setIcon(QIcon(":/use.bmp"));
m_pIcon->show();

本文介绍QSystemTrayIcon类,用于在系统托盘显示应用图标,并提供消息通知功能。适用于Windows、X11及MacOSX平台。文章还包含了创建和使用系统托盘图标的示例代码。
2261

被折叠的 条评论
为什么被折叠?



