From 45790ee0990f4ce572f1a2543061a50fd0f34292 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Fri, 8 May 2020 17:16:17 +0800 Subject: [PATCH] Fix old Qt build again. qAsConst was introduced in Qt 5.7 Signed-off-by: Yuhang Zhao <2546789017@qq.com> --- winnativeeventfilter.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/winnativeeventfilter.cpp b/winnativeeventfilter.cpp index ce5e5c3..8dc3637 100644 --- a/winnativeeventfilter.cpp +++ b/winnativeeventfilter.cpp @@ -39,21 +39,26 @@ #include #endif #include - -// All the following constants and macros are copied from Windows 10 SDK -// directly, without any modifications. +#if (QT_VERSION < QT_VERSION_CHECK(5, 7, 0)) +#include +#endif #ifdef IsMinimized #undef IsMinimized #endif -// Only available since Windows 2000 -#define IsMinimized m_lpIsIconic - #ifdef IsMaximized #undef IsMaximized #endif +namespace { + +// All the following enums, structs and function prototypes are copied from +// Windows 10 SDK directly, without any modifications. + +// Only available since Windows 2000 +#define IsMinimized m_lpIsIconic + // Only available since Windows 2000 #define IsMaximized m_lpIsZoomed @@ -178,11 +183,6 @@ } #endif -namespace { - -// All the following enums, structs and function prototypes are copied from -// Windows 10 SDK directly, without any modifications. - const UINT m_defaultDotsPerInch = USER_DEFAULT_SCREEN_DPI; const qreal m_defaultDevicePixelRatio = 1.0; @@ -238,6 +238,10 @@ using BP_PAINTPARAMS = struct _BP_PAINTPARAMS { CONST BLENDFUNCTION *pBlendFunction; }; +#if (QT_VERSION < QT_VERSION_CHECK(5, 7, 0)) +#define qAsConst std::as_const +#endif + bool isWin8OrGreator() { #if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) return QOperatingSystemVersion::current() >=