From e72401bf11e2ca9b3baa211b19f50f013f6e2c0c Mon Sep 17 00:00:00 2001 From: likehomedream Date: Tue, 2 Jan 2024 16:58:14 +0800 Subject: [PATCH] be single --- src/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 12dddbe..b2efa18 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,6 +8,12 @@ int main(int argc, char *argv[]) { QApplication a(argc, argv); initUkuiLog4qt("kylin-theme-builder"); + static QSharedMemory *singleApp = new QSharedMemory("kylin-theme-builder"); + if(!singleApp->create(1))//创建失败 + { + qApp->quit(); + return -1; + } //翻译 QTranslator app_trans; QString locale = QLocale::system().name();