From d47914155055418fc8e01791fcca71c9c1efb064 Mon Sep 17 00:00:00 2001
From: w1146869587 <wah1146869587@126.com>
Date: 星期五, 05 十一月 2021 17:12:26 +0800
Subject: [PATCH] mdy  git

---
 mbwatch/main.cpp |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/mbwatch/main.cpp b/mbwatch/main.cpp
index 470a030..1063d25 100644
--- a/mbwatch/main.cpp
+++ b/mbwatch/main.cpp
@@ -1,8 +1,14 @@
 #include <QCoreApplication>
+#include "mbwatchapp.h"
 
 int main(int argc, char *argv[])
 {
-    QCoreApplication a(argc, argv);
-
-    return a.exec();
+#if !defined(Q_OS_WIN)
+    // QtService stores service settings in SystemScope, which normally require root privileges.
+    // To allow testing this example as non-root, we change the directory of the SystemScope settings file.
+    QSettings::setPath(QSettings::NativeFormat, QSettings::SystemScope, QDir::tempPath());
+    qWarning("(Example uses dummy settings file: %s/QtSoftware.conf)", QDir::tempPath().toLatin1().constData());
+#endif
+    CMBWatchApp service(argc, argv);
+    return service.exec();
 }

--
Gitblit v1.9.1