From fb57149397a9a9081bb22053bf2c7ecbfd49a191 Mon Sep 17 00:00:00 2001 From: Kang Lin Date: Wed, 12 Jan 2022 09:20:45 +0800 Subject: [PATCH] Qt6: Fix windows complie error --- qtservice/src/qtservice_win.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/qtservice/src/qtservice_win.cpp b/qtservice/src/qtservice_win.cpp index e5b7ecc5..3b9a1ae1 100644 --- a/qtservice/src/qtservice_win.cpp +++ b/qtservice/src/qtservice_win.cpp @@ -737,10 +737,17 @@ class QtServiceAppEventFilter : public QAbstractNativeEventFilter { public: QtServiceAppEventFilter() {} - bool nativeEventFilter(const QByteArray &eventType, void *message, long *result); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + virtual bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result); +#else + bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override; +#endif }; - +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +bool QtServiceAppEventFilter::nativeEventFilter(const QByteArray &, void *message, qintptr *result) +#else bool QtServiceAppEventFilter::nativeEventFilter(const QByteArray &, void *message, long *result) +#endif { MSG *winMessage = (MSG*)message; if (winMessage->message == WM_ENDSESSION && (winMessage->lParam & ENDSESSION_LOGOFF)) {