From 9275074e1076d7505f7bdb066037cd85326eb8c2 Mon Sep 17 00:00:00 2001 From: zty199 <46324746+zty199@users.noreply.github.com> Date: Tue, 31 Jan 2023 12:12:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E5=90=8E=E5=8F=B0=E8=BF=90=E8=A1=8C=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E8=B0=83=E7=94=A8=20spk=20=E9=93=BE=E6=8E=A5=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E4=B8=8D=E4=BC=9A=E8=87=AA=E5=8A=A8=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 链接调用时仅执行了窗口 activateWindow() 操作,在窗口隐藏时无效 Log: 添加 setWindowState(Qt::WindowActive) 操作和 show() 操作 --- src/mainwindow-dtk.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mainwindow-dtk.cpp b/src/mainwindow-dtk.cpp index 33cbe15..f8ab730 100644 --- a/src/mainwindow-dtk.cpp +++ b/src/mainwindow-dtk.cpp @@ -61,7 +61,13 @@ void MainWindow::onGetUrl(const QString &url) { openUrl(url); } + + showWindowAnimation = false; + closeWindowAnimation = false; + + setWindowState(windowState() & Qt::WindowActive); activateWindow(); + show(); } void MainWindow::onNewProcessInstance(qint64 pid, const QStringList &arguments) @@ -227,7 +233,7 @@ void MainWindow::initTrayIcon() showWindowAnimation = false; closeWindowAnimation = false; - setWindowState(Qt::WindowActive); + setWindowState(windowState() & Qt::WindowActive); activateWindow(); show(); }); connect(aboutAction, &QAction::triggered, this, [=]() @@ -357,7 +363,7 @@ void MainWindow::initConnections() showWindowAnimation = false; closeWindowAnimation = false; - setWindowState(Qt::WindowActive); + setWindowState(windowState() & Qt::WindowActive); activateWindow(); show();