Is there a way to access the windows 7 progress bar with Qt? I\'m currently using Qt 4.7.0 with Qt Creator.
I already found Q7Goodies but unfortunately it is not free. S
You can use the QWinTaskbarProgress class. To use this class, you need to add win32:QT += winextras
in your .pro file.
Here is an example code showing how to show the value of a QProgressBar
in the Windows task bar (inspired from this example):
#ifdef _WIN32 //The _WIN32 macro is automatically generated when compiling for Windows
#include
#include
#endif
QProgressBar *progressBar = new QProgressBar;
progressBar->show();
#ifdef _WIN32
QWinTaskbarButton *windowsTaskbarButton = new QWinTaskbarButton; //Create the taskbar button which will show the progress
windowsTaskbarButton->setWindow(progressBar->windowHandle()); //Associate the taskbar button to the progress bar, assuming that the progress bar is its own window
QWinTaskbarProgress *windowsTaskbarProgress = windowsTaskbarButton->progress();
windowsTaskbarProgress->show();
QObject::connect(loadingWindow, &QProgressBar::valueChanged, [windowsTaskbarProgress](int value){
windowsTaskbarProgress->setValue(value); //Change the value of the progress in the taskbar when the value of the progress bar changes
});
#endif