From 657ea87cfad20605fb2f6327f19103d8687ccff7 Mon Sep 17 00:00:00 2001 From: youdiansaodongxi Date: Thu, 25 Jul 2024 10:50:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(src/windows):=20=E6=B7=BB=E5=8A=A0=E7=9B=91?= =?UTF-8?q?=E5=90=AC=E5=B1=8F=E5=B9=95=E5=B0=BA=E5=AF=B8=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/windows/menu-main-window.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/windows/menu-main-window.cpp b/src/windows/menu-main-window.cpp index 27c0286..fbb507c 100644 --- a/src/windows/menu-main-window.cpp +++ b/src/windows/menu-main-window.cpp @@ -78,7 +78,7 @@ void WindowHelper::setRegion(QWindow *window, qreal x, qreal y, qreal w, qreal h WindowGeometryHelper::WindowGeometryHelper(QObject *parent) : QObject(parent) { initPanelSetting(); - initScreenMonitor(); +// initScreenMonitor(); updateGeometry(); connect(MenuSetting::instance(), &MenuSetting::changed, this, [this] (const QString& key) { @@ -483,8 +483,14 @@ void MenuWindow::activeMenuWindow(bool active) } if (active) { - this->setScreen(UkuiQuick::WindowProxy::currentScreen()); - updateGeometry(); + if (screen() != UkuiQuick::WindowProxy::currentScreen()) { + if (screen()) { + screen()->disconnect(this); + } + this->setScreen(UkuiQuick::WindowProxy::currentScreen()); + connect(screen(), &QScreen::geometryChanged, this, &MenuWindow::updateGeometry); + updateGeometry(); + } } setVisible(active); -- Gitee