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 } }