Fix old Qt build

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2021-06-02 13:26:40 +08:00
parent 74607b2e45
commit 987a8397dc
2 changed files with 6 additions and 2 deletions

View File

@ -38,6 +38,8 @@
Q_GLOBAL_STATIC(FramelessHelper, framelessHelper) Q_GLOBAL_STATIC(FramelessHelper, framelessHelper)
#endif #endif
Q_DECLARE_METATYPE(const QObject *)
FramelessWindowsManager::FramelessWindowsManager() = default; FramelessWindowsManager::FramelessWindowsManager() = default;
void FramelessWindowsManager::addWindow(QWindow *window) void FramelessWindowsManager::addWindow(QWindow *window)

View File

@ -24,8 +24,11 @@
#include "utilities.h" #include "utilities.h"
#include <QtCore/qdebug.h> #include <QtCore/qdebug.h>
#include <QtCore/qvariant.h>
#include <QtGui/qguiapplication.h> #include <QtGui/qguiapplication.h>
Q_DECLARE_METATYPE(const QObject *)
QWindow *Utilities::findWindow(const WId winId) QWindow *Utilities::findWindow(const WId winId)
{ {
Q_ASSERT(winId); Q_ASSERT(winId);
@ -83,9 +86,8 @@ bool Utilities::isHitTestVisibleInChrome(const QWindow *window)
if (!window) { if (!window) {
return false; return false;
} }
QObjectList objs = {};
const auto target = qvariant_cast<const QObject *>(window->property(_flh_global::_flh_nativeParent_flag)); const auto target = qvariant_cast<const QObject *>(window->property(_flh_global::_flh_nativeParent_flag));
objs = target ? target->findChildren<QObject *>() : window->findChildren<QObject *>(); const QObjectList objs = target ? target->findChildren<QObject *>() : window->findChildren<QObject *>();
if (objs.isEmpty()) { if (objs.isEmpty()) {
return false; return false;
} }