QWindowsDialogHelperBase: use QBasicTimer instead of using raw timer IDs

Change-Id: I0124defa420e70f6d50a1e3f1fd02f14865d8e83
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Ahmad Samir 2024-09-04 17:11:06 +03:00
parent 769392c3a8
commit d91bfbcf65
2 changed files with 6 additions and 6 deletions

View File

@ -37,6 +37,8 @@
#include <algorithm>
#include <vector>
using namespace std::chrono_literals;
// #define USE_NATIVE_COLOR_DIALOG /* Testing purposes only */
QT_BEGIN_NAMESPACE
@ -269,7 +271,7 @@ bool QWindowsDialogHelperBase<BaseClass>::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<BaseClass>::startDialogThread()
template <class BaseClass>
void QWindowsDialogHelperBase<BaseClass>::stopTimer()
{
if (m_timerId) {
this->killTimer(m_timerId);
m_timerId = 0;
}
m_timer.stop();
}
template <class BaseClass>

View File

@ -7,6 +7,7 @@
#include <QtCore/qt_windows.h>
#include <qpa/qplatformdialoghelper.h>
#include <qpa/qplatformtheme.h>
#include <QtCore/qbasictimer.h>
#include <QtCore/qstringlist.h>
#include <QtCore/qsharedpointer.h>
@ -56,7 +57,7 @@ private:
QWindowsNativeDialogBasePtr m_nativeDialog;
HWND m_ownerWindow = nullptr;
int m_timerId = 0;
QBasicTimer m_timer;
QThread *m_thread = nullptr;
};