From 3e942c3dc8955be577079fbc028ce216e1c594b2 Mon Sep 17 00:00:00 2001
From: SineStriker <55847490+SineStriker@users.noreply.github.com>
Date: 周二, 11 2月 2025 19:07:53 +0800
Subject: [PATCH] Fix numerous bugs (#162)

---
 src/quick/quickwindowagent.cpp |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/src/quick/quickwindowagent.cpp b/src/quick/quickwindowagent.cpp
index 0731836..aaa321c 100644
--- a/src/quick/quickwindowagent.cpp
+++ b/src/quick/quickwindowagent.cpp
@@ -1,3 +1,7 @@
+// Copyright (C) 2023-2024 Stdware Collections (https://www.github.com/stdware)
+// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao)
+// SPDX-License-Identifier: Apache-2.0
+
 #include "quickwindowagent.h"
 #include "quickwindowagent_p.h"
 
@@ -7,6 +11,14 @@
 #include "quickitemdelegate_p.h"
 
 namespace QWK {
+
+    /*!
+        \class QuickWindowAgent
+        \brief QuickWindowAgent is the window agent for QtQuick.
+
+        It provides interfaces for QtQuick and processes some Qt events related to the QQuickItem
+        instance. The usage of all APIs is consistent with the \a Widgets module.
+    */
 
     QuickWindowAgentPrivate::QuickWindowAgentPrivate() = default;
 
@@ -32,6 +44,9 @@
             return false;
         }
 
+        // Make sure the native window handle is actually created before we apply
+        // various hooks. But we don't need the actual window handle so just ignore it.
+        std::ignore = window->winId();
         d->setup(window, new QuickItemDelegate());
         d->hostWindow = window;
 
@@ -51,6 +66,9 @@
         if (!d->context->setTitleBar(item)) {
             return;
         }
+#ifdef Q_OS_MAC
+        setSystemButtonArea(nullptr);
+#endif
         Q_EMIT titleBarWidgetChanged(item);
     }
 
@@ -67,19 +85,26 @@
         Q_EMIT systemButtonChanged(button, item);
     }
 
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
+    bool QuickWindowAgent::isHitTestVisible(QQuickItem *item) const {
+#else
     bool QuickWindowAgent::isHitTestVisible(const QQuickItem *item) const {
+#endif
         Q_D(const QuickWindowAgent);
         return d->context->isHitTestVisible(item);
     }
 
-    void QuickWindowAgent::setHitTestVisible(const QQuickItem *item, bool visible) {
+    void QuickWindowAgent::setHitTestVisible(QQuickItem *item, bool visible) {
         Q_D(QuickWindowAgent);
         d->context->setHitTestVisible(item, visible);
     }
 
+    /*!
+        \internal
+    */
     QuickWindowAgent::QuickWindowAgent(QuickWindowAgentPrivate &d, QObject *parent)
         : WindowAgentBase(d, parent) {
         d.init();
     }
 
-}
\ No newline at end of file
+}

--
Gitblit v1.9.1