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 );
@@ -251,6 +253,7 @@ BitcoinGUI::~BitcoinGUI()
251253 delete m_app_nap_inhibitor;
252254 MacDockIconHandler::cleanup ();
253255#endif
256+ delete m_taskbar_progress;
254257
255258 delete NetWatch;
256259 delete rpcConsole;
@@ -1235,11 +1238,6 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
12351238
12361239 tooltip = tr (" Processed %n block(s) of transaction history." , " " , count);
12371240
1238- #ifdef BITCOIN_QT_WIN_TASKBAR
1239- m_taskbar_button->setWindow (windowHandle ());
1240- QWinTaskbarProgress* taskbar_progress = m_taskbar_button->progress ();
1241- #endif
1242-
12431241 // Set icon state: spinning if catching up, tick otherwise
12441242 if (secs < MAX_BLOCK_TIME_GAP) {
12451243 tooltip = tr (" Up to date" ) + QString (" .<br>" ) + tooltip;
@@ -1256,7 +1254,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
12561254 progressBarLabel->setVisible (false );
12571255 progressBar->setVisible (false );
12581256#ifdef BITCOIN_QT_WIN_TASKBAR
1259- taskbar_progress ->setVisible (false );
1257+ m_taskbar_progress ->setVisible (false );
12601258#endif
12611259 }
12621260 else
@@ -1273,8 +1271,8 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
12731271 progressBar->setValue (nVerificationProgress * 1000000000.0 + 0.5 );
12741272 progressBar->setVisible (true );
12751273#ifdef BITCOIN_QT_WIN_TASKBAR
1276- taskbar_progress ->setValue (qRound (nVerificationProgress * 100.0 ));
1277- taskbar_progress ->setVisible (true );
1274+ m_taskbar_progress ->setValue (qRound (nVerificationProgress * 100.0 ));
1275+ m_taskbar_progress ->setVisible (true );
12781276#endif
12791277
12801278 tooltip = tr (" Catching up…" ) + QString (" <br>" ) + tooltip;
@@ -1445,6 +1443,13 @@ void BitcoinGUI::showEvent(QShowEvent *event)
14451443 showMempoolStatsAction->setEnabled (true );
14461444 aboutAction->setEnabled (true );
14471445 optionsAction->setEnabled (true );
1446+
1447+ #ifdef BITCOIN_QT_WIN_TASKBAR
1448+ // If window handle wasn't available during construction, set it now
1449+ if (m_taskbar_progress && !m_taskbar_progress->window () && windowHandle ()) {
1450+ m_taskbar_progress->setWindow (windowHandle ());
1451+ }
1452+ #endif
14481453}
14491454
14501455#ifdef ENABLE_WALLET
0 commit comments