Remove redundant _guiAppInstance
authoralex-z <blackslayer4@gmail.com>
Thu, 31 Mar 2022 13:18:54 +0000 (16:18 +0300)
committerMatthieu Gallien (Rebase PR Action) <matthieu_gallien@yahoo.fr>
Fri, 1 Apr 2022 08:41:35 +0000 (08:41 +0000)
Signed-off-by: alex-z <blackslayer4@gmail.com>
src/gui/application.cpp
src/gui/systray.h

index 5320ade6945e3cb17ba34c38598544a6efb698e4..9fbd620eba9c98a9d32676c42ce4ee387c546cf2 100644 (file)
@@ -111,22 +111,12 @@ public:
     bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) {
         const auto msg = static_cast<MSG *>(message);
         if(msg->message == WM_SYSCOLORCHANGE || msg->message == WM_SETTINGCHANGE) {
-            if(!_guiAppInstance) {
-                const auto ptr = qobject_cast<QGuiApplication *>(QGuiApplication::instance());
-                if(ptr) {
-                    _guiAppInstance.reset(ptr);
-                }
-            }
-
-            if(_guiAppInstance) {
-                emit _guiAppInstance->paletteChanged(_guiAppInstance->palette());
+            if (const auto ptr = qobject_cast<QGuiApplication *>(QGuiApplication::instance())) {
+                emit ptr->paletteChanged(ptr->palette());
             }
         }
         return false;
     }
-
-private:
-    QScopedPointer<QGuiApplication> _guiAppInstance;
 };
 #endif
 
index d5cdce358656ab54599a7ee1c0f04c9ea5f1a641..0b4aabc3ec79b33ee5c7b98790a50c6a2d411485 100644 (file)
@@ -120,8 +120,6 @@ private:
     QPointer<QQmlApplicationEngine> _trayEngine;
 
     AccessManagerFactory _accessManagerFactory;
-
-    QScopedPointer<QGuiApplication> _guiAppInstance;
 };
 
 } // namespace OCC