From a78ee36ae7e0e78ee5963025449b7423d87598cf Mon Sep 17 00:00:00 2001 From: momen Date: Fri, 12 Sep 2025 23:18:17 +0800 Subject: [PATCH] =?UTF-8?q?chore:=E7=BB=99=E5=85=B3=E9=97=AD=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E6=B7=BB=E5=8A=A0=E8=AF=A2=E9=97=AE=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mainwindow.cpp | 4 ++++ src/mainwindow.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 23dd379..466a730 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -261,7 +261,11 @@ void MainWindow::runAptssUpgrade() QMessageBox::warning(this, "升级失败", "执行 sudo aptss ssupdate 失败,请检查系统环境或稍后再试。"); } } +void MainWindow::closeEvent(QCloseEvent *event) +{ + QMessageBox::StandardButton reply = QMessageBox::question(this, "确认关闭", "正在更新,是否确认关闭窗口?", QMessageBox::Yes | QMessageBox::No); +} MainWindow::~MainWindow() { delete ui; diff --git a/src/mainwindow.h b/src/mainwindow.h index d754b5f..b587750 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -22,6 +22,9 @@ public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); +protected: + void closeEvent(QCloseEvent *event) override; + private: Ui::MainWindow *ui; void checkUpdates();