From 1b4b5b620faa20bdfb114e982e916a5ea35bcd8f Mon Sep 17 00:00:00 2001 From: Yuhang Zhao Date: Sat, 29 Jul 2023 16:25:47 +0800 Subject: [PATCH] fix qt5 builds --- .../FramelessHelper/Core/framelesshelpercore_global.h | 9 ++++++++- src/core/framelesshelper_win.cpp | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/FramelessHelper/Core/framelesshelpercore_global.h b/include/FramelessHelper/Core/framelesshelpercore_global.h index fcfa598d..c3e3d666 100644 --- a/include/FramelessHelper/Core/framelesshelpercore_global.h +++ b/include/FramelessHelper/Core/framelesshelpercore_global.h @@ -100,6 +100,13 @@ QT_END_NAMESPACE using QT_ENTER_EVENT_TYPE = QEvent; #endif +// QLatin1StringView can't be constexpr until Qt6? +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) +# define Q_STRING_CONSTEXPR constexpr +#else +# define Q_STRING_CONSTEXPR +#endif + #ifndef QUtf8String # define QUtf8String(str) QString::fromUtf8(str) #endif @@ -167,7 +174,7 @@ QT_END_NAMESPACE #ifndef FRAMELESSHELPER_STRING_CONSTANT2 # define FRAMELESSHELPER_STRING_CONSTANT2(name, str) \ - [[maybe_unused]] static constexpr const auto k##name = FRAMELESSHELPER_STRING(str); + [[maybe_unused]] static Q_STRING_CONSTEXPR const auto k##name = FRAMELESSHELPER_STRING(str); #endif #ifndef FRAMELESSHELPER_BYTEARRAY_CONSTANT diff --git a/src/core/framelesshelper_win.cpp b/src/core/framelesshelper_win.cpp index 71ed3414..0e488cc1 100644 --- a/src/core/framelesshelper_win.cpp +++ b/src/core/framelesshelper_win.cpp @@ -648,7 +648,7 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me const LPARAM lParam = msg->lParam; #if (QT_VERSION < QT_VERSION_CHECK(6, 5, 1)) - const auto updateRestoreGeometry = [windowId, &data](const bool ignoreWindowState) -> void { + const auto updateRestoreGeometry = [windowId, &muData](const bool ignoreWindowState) -> void { if (!ignoreWindowState && !Utils::isWindowNoState(windowId)) { return; }