Hi,
I have a QT application (QT .9.1) and I need to modify the icon in the windows taskbar, when I have an error. I am trying with QWinTaskbarButton, it seems to be really simple but I failed.
My application is a QtQuickControlsApplication (a QApplication), where I have a manager QObject class.
In this class I create a QQmlApplicationEngine, which I use to load the main QML.
From the documentation (http://doc.qt.io/qt-5/qwintaskbarbutton.html#details):
QWinTaskbarButton *button = new QWinTaskbarButton(widget);
button->setWindow(widget->windowHandle());
button
->setOverlayIcon
(QIcon(":/loading.png"));
QWinTaskbarButton *button = new QWinTaskbarButton(widget);
button->setWindow(widget->windowHandle());
button->setOverlayIcon(QIcon(":/loading.png"));
To copy to clipboard, switch view to plain text mode
But i don't know what to set in 'widget' and 'widget->windowHandle()'
I have tried to get a widget from the qApp but failed:
qApp->activeWindow() is NULL
qApp->topLevelWindows().at(0) is valid, but failed:
QWinTaskbarButton *button = new QWinTaskbarButton(qApp->topLevelWindows().at(0));
button->setWindow(qApp->allWidgets().at(0)->windowHandle());
button
->setOverlayIcon
(QIcon(":/images/icon.png"));
qApp->activeWindow() is NULL
qApp->topLevelWindows().at(0) is valid, but failed:
QWinTaskbarButton *button = new QWinTaskbarButton(qApp->topLevelWindows().at(0));
button->setWindow(qApp->allWidgets().at(0)->windowHandle());
button->setOverlayIcon(QIcon(":/images/icon.png"));
To copy to clipboard, switch view to plain text mode
I would appreciate any help,
Thanks in advance,
Diego
Bookmarks