From a136ccba80640bca4723a992b7e135219968edc1 Mon Sep 17 00:00:00 2001 From: xiepengfei Date: Mon, 2 Dec 2024 11:41:31 +0800 Subject: [PATCH] fix: Fixed the issue of waiting for restart after exiting Fixed the issue of waiting for restart after exiting Bug: https://pms.uniontech.com/bug-view-289903.html Log: Fixed the issue of waiting for restart after exiting --- src/qml/main.qml | 1 + src/src/globalcontrol.cpp | 7 +++++++ src/src/globalcontrol.h | 1 + 3 files changed, 9 insertions(+) diff --git a/src/qml/main.qml b/src/qml/main.qml index 96156446..b318b62a 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -118,6 +118,7 @@ ApplicationWindow { onClosing: { FileControl.saveSetting() FileControl.terminateShortcutPanelProcess() //结束快捷键面板进程 + GControl.forceExit(); } FileDialog { diff --git a/src/src/globalcontrol.cpp b/src/src/globalcontrol.cpp index 7f9fc312..b2f4932c 100644 --- a/src/src/globalcontrol.cpp +++ b/src/src/globalcontrol.cpp @@ -11,6 +11,7 @@ #include #include #include +#include static const int sc_SubmitInterval = 200; // 图片变更提交定时间隔 200ms @@ -266,6 +267,12 @@ bool GlobalControl::lastImage() return false; } +bool GlobalControl::forceExit() +{ + QApplication::exit(0); + _Exit(0); +} + /** @brief 设置打开图片列表 \a filePaths , 其中 \a openFile 是首个展示的图片路径, 将更新全局数据源并发送状态变更信号 diff --git a/src/src/globalcontrol.h b/src/src/globalcontrol.h index c0c99312..81e1640c 100644 --- a/src/src/globalcontrol.h +++ b/src/src/globalcontrol.h @@ -69,6 +69,7 @@ class GlobalControl : public QObject Q_INVOKABLE bool nextImage(); Q_INVOKABLE bool firstImage(); Q_INVOKABLE bool lastImage(); + Q_INVOKABLE bool forceExit(); // 图像文件变更操作 Q_SLOT void setImageFiles(const QStringList &imageFiles, const QString &openFile);