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):

Qt Code:
  1. QWinTaskbarButton *button = new QWinTaskbarButton(widget);
  2. button->setWindow(widget->windowHandle());
  3. 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:
Qt Code:
  1. qApp->activeWindow() is NULL
  2. qApp->topLevelWindows().at(0) is valid, but failed:
  3.  
  4. QWinTaskbarButton *button = new QWinTaskbarButton(qApp->topLevelWindows().at(0));
  5. button->setWindow(qApp->allWidgets().at(0)->windowHandle());
  6. 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