From 2f59395b8183b1de62bd0ba83685298d9a7e3271 Mon Sep 17 00:00:00 2001
From: Sine Striker <trueful@163.com>
Date: 摹曛, 21 12月 2023 19:56:42 +0800
Subject: [PATCH] minor tweaks

---
 src/stylesupport/styleagent.cpp |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/stylesupport/styleagent.cpp b/src/stylesupport/styleagent.cpp
index d8bc9b0..d24186f 100644
--- a/src/stylesupport/styleagent.cpp
+++ b/src/stylesupport/styleagent.cpp
@@ -8,11 +8,18 @@
     StyleAgentPrivate::StyleAgentPrivate() {
     }
 
-    StyleAgentPrivate::~StyleAgentPrivate() {
-    }
+    StyleAgentPrivate::~StyleAgentPrivate() = default;
 
     void StyleAgentPrivate::init() {
-        setupSystemThemeHook();
+    }
+
+    void StyleAgentPrivate::notifyThemeChanged(StyleAgent::SystemTheme theme) {
+        if (theme == systemTheme)
+            return;
+        systemTheme = theme;
+
+        Q_Q(StyleAgent);
+        Q_EMIT q->systemThemeChanged();
     }
 
     void StyleAgentPrivate::_q_windowDestroyed() {
@@ -20,9 +27,18 @@
     }
 
     StyleAgent::StyleAgent(QObject *parent) : StyleAgent(*new StyleAgentPrivate(), parent) {
+        Q_D(StyleAgent);
+        d->setupSystemThemeHook();
     }
 
     StyleAgent::~StyleAgent() {
+        Q_D(StyleAgent);
+        d->removeSystemThemeHook();
+    }
+
+    StyleAgent::SystemTheme StyleAgent::systemTheme() const {
+        Q_D(const StyleAgent);
+        return d->systemTheme;
     }
 
     QVariant StyleAgent::windowAttribute(QWindow *window, const QString &key) const {

--
Gitblit v1.9.1