The Qt library provides a number of platform-dependent features. One of these features for Windows is the use of the progress bar on the taskbar icon. This option is available for the OS since version 7.
To use this and some other features, you need to connect the winextras module,
QT += winextras
and add macros
In the constructor of the main window we place
if (QtWin::isCompositionEnabled()) QtWin::extendFrameIntoClientArea(this, 0, 0, 0, 0); else QtWin::resetExtendedFrame(this);
To display the progress line, you must create a QWinTaskbarButton object,
QWinTaskbarButton *button; button = new QWinTaskbarButton(this);
bind it to the application window,
create a pointer to a QWinTaskbarProgress class object
and assign it
progress = button->progress();
In many ways, the QWinTaskbarProgress object is identical to the QProgressBar object. For it, you can set the boundaries of the changes different from the default values (0 and 100) using the setMaximum (int), setMinimum (int), setRange (int, int) methods and set the current value using setValue (int). The show () method makes the progress bar visible, hide () has the opposite effect.
The progress bar is displayed in one of 3 colors: green (active mode), yellow (pause), red (stop). After creation, the progress bar is in active mode. You can set or remove the pause mode using the setPaused (bool) function. Calling the stop () method puts the bar in stop mode. From this mode you can not withdraw it. The only possibility is to delete the QWinTaskbarButton object and create a new one. In any of the modes, you can change the values of the progress bar in the direction of increasing or decreasing.
An example of the program can be downloaded from the link .