diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index 0ce0b0e2a75..ab67b7ba377 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -37,6 +37,8 @@ #include #include +using namespace std::chrono_literals; + // #define USE_NATIVE_COLOR_DIALOG /* Testing purposes only */ QT_BEGIN_NAMESPACE @@ -269,7 +271,7 @@ bool QWindowsDialogHelperBase::show(Qt::WindowFlags, // timer is stopped and dialog->exec() is called directly. cleanupThread(); if (modal) { - m_timerId = this->startTimer(0); + m_timer.start(0ns, this); } else { startDialogThread(); } @@ -289,10 +291,7 @@ void QWindowsDialogHelperBase::startDialogThread() template void QWindowsDialogHelperBase::stopTimer() { - if (m_timerId) { - this->killTimer(m_timerId); - m_timerId = 0; - } + m_timer.stop(); } template diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.h b/src/plugins/platforms/windows/qwindowsdialoghelpers.h index 64f40bc3a9d..71f7f7d3df3 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.h +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -56,7 +57,7 @@ private: QWindowsNativeDialogBasePtr m_nativeDialog; HWND m_ownerWindow = nullptr; - int m_timerId = 0; + QBasicTimer m_timer; QThread *m_thread = nullptr; };