QSystemTrayIcon

17 篇文章 1 订阅

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 system tray on Windows XP.

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 QDesktopServicesQDesktopWidgetDesktop Integration, and System Tray Icon Example.



实例:

    m_pIcon = new QSystemTrayIcon();
    m_pIcon->setIcon(QIcon(":/use.bmp"));
    m_pIcon->show();

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值