From 5dbf2d71aa0aa6b8f0cb8f1334d061e0d759caf8 Mon Sep 17 00:00:00 2001
From: Sine Striker <trueful@163.com>
Date: 周一, 11 12月 2023 22:18:38 +0800
Subject: [PATCH] Add workaround handling misplace

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

diff --git a/src/quick/quickwindowagent.cpp b/src/quick/quickwindowagent.cpp
index 74a032b..180779b 100644
--- a/src/quick/quickwindowagent.cpp
+++ b/src/quick/quickwindowagent.cpp
@@ -38,7 +38,7 @@
         anchors->setLeft(parentPri->left());
         anchors->setRight(parentPri->right());
 
-        setZ(std::numeric_limits<qreal>::max());
+        setZ(10);
     }
 
     BorderItem::~BorderItem() = default;
@@ -86,7 +86,6 @@
     }
 
     void QuickWindowAgentPrivate::init() {
-        borderItem = std::make_unique<BorderItem>(context.get(), hostWindow->contentItem());
     }
 
     QuickWindowAgent::QuickWindowAgent(QObject *parent)
@@ -111,6 +110,12 @@
             return false;
         }
         d->hostWindow = window;
+
+        if (bool needPaintBorder = false;
+            d->context->virtual_hook(AbstractWindowContext::NeedsDrawBordersHook, &needPaintBorder),
+            needPaintBorder) {
+            d->borderItem = std::make_unique<BorderItem>(d->context.get(), window->contentItem());
+        }
         return true;
     }
 

--
Gitblit v1.9.1