From 1cd1b0cc2bad9021b8c38c516dbb15a6d11745d3 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Sun, 26 Jul 2020 09:33:41 +0800 Subject: [PATCH] Adapt to Qt6 changes, again. Forgot to change this file. Signed-off-by: Yuhang Zhao <2546789017@qq.com> --- framelesshelper.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/framelesshelper.cpp b/framelesshelper.cpp index 88cf765..24ab7f9 100644 --- a/framelesshelper.cpp +++ b/framelesshelper.cpp @@ -38,7 +38,12 @@ #include #include #include +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) #include +#else +#include +#include +#endif Q_DECLARE_METATYPE(QMargins) @@ -84,6 +89,7 @@ void FramelessHelper::updateQtFrame(QWindow *window, const int titleBarHeight) // window. window->setProperty("_q_windowsCustomMargins", marginsVar); // If a platform window exists, change via native interface. +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) QPlatformWindow *platformWindow = window->handle(); if (platformWindow) { QGuiApplication::platformNativeInterface() @@ -91,6 +97,13 @@ void FramelessHelper::updateQtFrame(QWindow *window, const int titleBarHeight) QString::fromUtf8("WindowsCustomMargins"), marginsVar); } +#else + auto *platformWindow = dynamic_cast( + window->handle()); + if (platformWindow) { + platformWindow->setCustomMargins(margins); + } +#endif } }