From 979595c8d8a220d095ff3de763f1891092afb8ae Mon Sep 17 00:00:00 2001 From: Mike Solar Date: Sun, 13 Aug 2023 17:00:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A8=8B=E5=BA=8F=E9=80=80?= =?UTF-8?q?=E5=87=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OfficeAssistant_msvc/exitmanager.h | 35 ++---------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/OfficeAssistant_msvc/exitmanager.h b/OfficeAssistant_msvc/exitmanager.h index 2d0a820..98048ae 100644 --- a/OfficeAssistant_msvc/exitmanager.h +++ b/OfficeAssistant_msvc/exitmanager.h @@ -3,38 +3,13 @@ #include #include #include "sqlitehelper.h" -template -class AutoDeleteList -{ -public: - // 添加对象 - void add(T *obj) - { - objs.append(obj); - } - - // 析构对象列表 - ~AutoDeleteList() - { - qDeleteAll(objs); - } - -private: - QList objs; -}; class ExitManager : public QObject { Q_OBJECT public: - // 添加需要在退出时自动析构的对象 - template - void add(T *obj) - { - autoDeleteList.add(obj); - } - + // 退出应用程序 void exit(int exitCode = 0) { @@ -42,14 +17,8 @@ public: sqlite_helper.db.close(); QSqlDatabase::removeDatabase("mydb"); // 发射退出应用程序信号 - emit exitApplication(exitCode); + ::exit(exitCode); } -signals: - // 退出应用程序信号 - void exitApplication(int exitCode); -private: - // 自动析构对象列表 - AutoDeleteList autoDeleteList; }; \ No newline at end of file