Adapt to Qt6 change.
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
7073c4a259
commit
6aea9a3ce9
|
@ -29,7 +29,6 @@
|
||||||
#include <QLibrary>
|
#include <QLibrary>
|
||||||
#include <QMargins>
|
#include <QMargins>
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
#include <qpa/qplatformnativeinterface.h>
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
|
||||||
#include <QOperatingSystemVersion>
|
#include <QOperatingSystemVersion>
|
||||||
#else
|
#else
|
||||||
|
@ -42,6 +41,12 @@
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#endif
|
#endif
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
#include <qpa/qplatformnativeinterface.h>
|
||||||
|
#else
|
||||||
|
#include <qpa/qplatformwindow.h>
|
||||||
|
#include <qpa/qplatformwindow_p.h>
|
||||||
|
#endif
|
||||||
#ifdef WNEF_LINK_SYSLIB
|
#ifdef WNEF_LINK_SYSLIB
|
||||||
#include <dwmapi.h>
|
#include <dwmapi.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
|
@ -54,7 +59,7 @@ Q_DECLARE_METATYPE(QMargins)
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 7, 0))
|
#if (QT_VERSION < QT_VERSION_CHECK(5, 7, 0))
|
||||||
#define qAsConst std::as_const
|
#define qAsConst(i) std::as_const(i)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef USER_DEFAULT_SCREEN_DPI
|
#ifndef USER_DEFAULT_SCREEN_DPI
|
||||||
|
@ -1868,6 +1873,7 @@ void WinNativeEventFilter::updateQtFrame(QWindow *window, const int titleBarHeig
|
||||||
// window.
|
// window.
|
||||||
window->setProperty("_q_windowsCustomMargins", marginsVar);
|
window->setProperty("_q_windowsCustomMargins", marginsVar);
|
||||||
// If a platform window exists, change via native interface.
|
// If a platform window exists, change via native interface.
|
||||||
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
QPlatformWindow *platformWindow = window->handle();
|
QPlatformWindow *platformWindow = window->handle();
|
||||||
if (platformWindow) {
|
if (platformWindow) {
|
||||||
QGuiApplication::platformNativeInterface()
|
QGuiApplication::platformNativeInterface()
|
||||||
|
@ -1875,6 +1881,13 @@ void WinNativeEventFilter::updateQtFrame(QWindow *window, const int titleBarHeig
|
||||||
QString::fromUtf8("WindowsCustomMargins"),
|
QString::fromUtf8("WindowsCustomMargins"),
|
||||||
marginsVar);
|
marginsVar);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
auto *platformWindow = dynamic_cast<QPlatformInterface::Private::QWindowsWindow *>(
|
||||||
|
window->handle());
|
||||||
|
if (platformWindow) {
|
||||||
|
platformWindow->setCustomMargins(margins);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue