Fix old Qt build again.

qAsConst was introduced in Qt 5.7

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2020-05-08 17:16:17 +08:00
parent e01d8a0183
commit 45790ee099
1 changed files with 15 additions and 11 deletions

View File

@ -39,21 +39,26 @@
#include <QWidget> #include <QWidget>
#endif #endif
#include <QtMath> #include <QtMath>
#if (QT_VERSION < QT_VERSION_CHECK(5, 7, 0))
// All the following constants and macros are copied from Windows 10 SDK #include <utility>
// directly, without any modifications. #endif
#ifdef IsMinimized #ifdef IsMinimized
#undef IsMinimized #undef IsMinimized
#endif #endif
// Only available since Windows 2000
#define IsMinimized m_lpIsIconic
#ifdef IsMaximized #ifdef IsMaximized
#undef IsMaximized #undef IsMaximized
#endif #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 // Only available since Windows 2000
#define IsMaximized m_lpIsZoomed #define IsMaximized m_lpIsZoomed
@ -178,11 +183,6 @@
} }
#endif #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 UINT m_defaultDotsPerInch = USER_DEFAULT_SCREEN_DPI;
const qreal m_defaultDevicePixelRatio = 1.0; const qreal m_defaultDevicePixelRatio = 1.0;
@ -238,6 +238,10 @@ using BP_PAINTPARAMS = struct _BP_PAINTPARAMS {
CONST BLENDFUNCTION *pBlendFunction; CONST BLENDFUNCTION *pBlendFunction;
}; };
#if (QT_VERSION < QT_VERSION_CHECK(5, 7, 0))
#define qAsConst std::as_const
#endif
bool isWin8OrGreator() { bool isWin8OrGreator() {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
return QOperatingSystemVersion::current() >= return QOperatingSystemVersion::current() >=