From cfa8e04755a0f9f5b75af33e71ddd97a523b6863 Mon Sep 17 00:00:00 2001 From: momen Date: Sun, 27 Jul 2025 15:23:57 +0800 Subject: [PATCH] =?UTF-8?q?chore:=E7=94=9F=E6=88=90=E5=88=B0=E7=94=BB?= =?UTF-8?q?=E9=9D=A2=E4=B8=AD=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mainwindow.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 54f064c..102bda6 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -75,6 +75,12 @@ MainWindow::MainWindow(QWidget *parent) watcher->setFuture(QtConcurrent::run([this](){ runAptssUpgrade(); })); + QScreen *screen = QGuiApplication::screenAt(QCursor::pos()); + if (!screen) screen = QGuiApplication::primaryScreen(); + QRect screenGeometry = screen->geometry(); + int x = screenGeometry.x() + (screenGeometry.width() - this->width()) / 2; + int y = screenGeometry.y() + (screenGeometry.height() - this->height()) / 2; + this->move(x, y); } //初始化控件样式 void MainWindow::initStyle()