3535#include < qt/macdockiconhandler.h>
3636#endif
3737#ifdef BITCOIN_QT_WIN_TASKBAR
38- #include < QWinTaskbarButton>
39- #include < QWinTaskbarProgress>
38+ #include < qt/wintaskbarprogress.h>
4039#endif
4140
4241#include < chain.h>
@@ -232,7 +231,10 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
232231 m_app_nap_inhibitor = new CAppNapInhibitor;
233232#endif
234233#ifdef BITCOIN_QT_WIN_TASKBAR
235- m_taskbar_button = new QWinTaskbarButton (this );
234+ m_taskbar_progress = new WinTaskbarProgress ();
235+ if (windowHandle ()) {
236+ m_taskbar_progress->setWindow (windowHandle ());
237+ }
236238#endif
237239
238240 GUIUtil::handleCloseWindowShortcut (this );
@@ -252,7 +254,7 @@ BitcoinGUI::~BitcoinGUI()
252254 MacDockIconHandler::cleanup ();
253255#endif
254256#ifdef BITCOIN_QT_WIN_TASKBAR
255- delete m_taskbar_button ;
257+ delete m_taskbar_progress ;
256258#endif
257259
258260 delete NetWatch;
@@ -1238,11 +1240,6 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
12381240
12391241 tooltip = tr (" Processed %n block(s) of transaction history." , " " , count);
12401242
1241- #ifdef BITCOIN_QT_WIN_TASKBAR
1242- m_taskbar_button->setWindow (windowHandle ());
1243- QWinTaskbarProgress* taskbar_progress = m_taskbar_button->progress ();
1244- #endif
1245-
12461243 // Set icon state: spinning if catching up, tick otherwise
12471244 if (secs < MAX_BLOCK_TIME_GAP) {
12481245 tooltip = tr (" Up to date" ) + QString (" .<br>" ) + tooltip;
@@ -1259,7 +1256,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
12591256 progressBarLabel->setVisible (false );
12601257 progressBar->setVisible (false );
12611258#ifdef BITCOIN_QT_WIN_TASKBAR
1262- taskbar_progress ->setVisible (false );
1259+ m_taskbar_progress ->setVisible (false );
12631260#endif
12641261 }
12651262 else
@@ -1276,8 +1273,8 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
12761273 progressBar->setValue (nVerificationProgress * 1000000000.0 + 0.5 );
12771274 progressBar->setVisible (true );
12781275#ifdef BITCOIN_QT_WIN_TASKBAR
1279- taskbar_progress ->setValue (qRound (nVerificationProgress * 100.0 ));
1280- taskbar_progress ->setVisible (true );
1276+ m_taskbar_progress ->setValue (qRound (nVerificationProgress * 100.0 ));
1277+ m_taskbar_progress ->setVisible (true );
12811278#endif
12821279
12831280 tooltip = tr (" Catching up…" ) + QString (" <br>" ) + tooltip;
@@ -1448,6 +1445,13 @@ void BitcoinGUI::showEvent(QShowEvent *event)
14481445 showMempoolStatsAction->setEnabled (true );
14491446 aboutAction->setEnabled (true );
14501447 optionsAction->setEnabled (true );
1448+
1449+ #ifdef BITCOIN_QT_WIN_TASKBAR
1450+ // If window handle wasn't available during construction, set it now
1451+ if (m_taskbar_progress && !m_taskbar_progress->window () && windowHandle ()) {
1452+ m_taskbar_progress->setWindow (windowHandle ());
1453+ }
1454+ #endif
14511455}
14521456
14531457#ifdef ENABLE_WALLET
0 commit comments