QWinTaskbarButton Class

The QWinTaskbarButton class represents the Windows taskbar button for a top-level window (Windows 7 and newer). 更多...

头文件: #include <QWinTaskbarButton>
qmake: QT += winextras
开始支持版本: Qt 5.2
基类: QObject

属性

公有函数

QWinTaskbarButton(QObject *parent = Q_NULLPTR)
~QWinTaskbarButton()
QString overlayAccessibleDescription() const
QIcon overlayIcon() const
QWinTaskbarProgress *progress() const
void setWindow(QWindow *window)
QWindow *window() const
  • 32 个公有函数继承自 QObject

公有槽函数

void clearOverlayIcon()
void setOverlayAccessibleDescription(const QString &description)
void setOverlayIcon(const QIcon &icon)
  • 1 个公有槽函数继承自 QObject

其他继承的成员

  • 2 个信号继承自 QObject
  • 1 个公有变量继承自 QObject
  • 10 个静态公有成员继承自 QObject
  • 9 个受保护的函数继承自 QObject
  • 2 个受保护的变量继承自 QObject

详细描述

The QWinTaskbarButton class represents the Windows taskbar button for a top-level window (Windows 7 and newer).

The QWinTaskbarButton class enables you to set overlay icons on a taskbar button, and provides access to its progress indicator.

An overlay icon indicates change in the state of an application, whereas a progress indicator shows how time-consuming tasks are progressing.

Taskbar Button

The following example code illustrates how to use the QWinTaskbarButton and QWinTaskbarProgress classes to adjust the look of the taskbar button:


      QWinTaskbarButton *button = new QWinTaskbarButton(widget);
      button->setWindow(widget->windowHandle());
      button->setOverlayIcon(QIcon(":/loading.png"));

      QWinTaskbarProgress *progress = button->progress();
      progress->setVisible(true);
      progress->setValue(50);

Note: QWidget::windowHandle() returns a valid instance of a QWindow only after the widget has been shown. It is therefore recommended to delay the initialization of the QWinTaskbarButton instances until QWidget::showEvent().

Note: The class wraps API only available since Windows 7. Instantiating it on Windows XP or Windows Vista causes a runtime warning.

参见 QWinTaskbarProgress.

属性

overlayAccessibleDescription : QString

This property holds the description of the overlay for accessibility purposes

访问函数:

QString overlayAccessibleDescription() const
void setOverlayAccessibleDescription(const QString &description)

参见 overlayIcon.

overlayIcon : QIcon

This property holds the overlay icon of the taskbar button

访问函数:

QIcon overlayIcon() const
void setOverlayIcon(const QIcon &icon)
void clearOverlayIcon()

progress : QWinTaskbarProgress * const

This property holds the progress indicator of the taskbar button

Note: The progress indicator is not visible by default.

访问函数:

QWinTaskbarProgress *progress() const

window : QWindow *

This property holds the window whose taskbar button is manipulated

访问函数:

QWindow *window() const
void setWindow(QWindow *window)

成员函数

QWinTaskbarButton::QWinTaskbarButton(QObject *parent = Q_NULLPTR)

Constructs a QWinTaskbarButton with the specified parent.

If parent is an instance of QWindow, it is automatically assigned as the taskbar button's window.

QWinTaskbarButton::~QWinTaskbarButton()

Destroys the QWinTaskbarButton.