From d08030ea8f04f056aed88a4ad96dc9233d069787 Mon Sep 17 00:00:00 2001
From: Sine Striker <trueful@163.com>
Date: 周一, 01 1月 2024 19:18:10 +0800
Subject: [PATCH] Add license

---
 src/core/style/styleagent.cpp |   40 +++++++++++++++++++++++++++++++++++-----
 1 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/src/core/style/styleagent.cpp b/src/core/style/styleagent.cpp
index 47ef5de..16ff148 100644
--- a/src/core/style/styleagent.cpp
+++ b/src/core/style/styleagent.cpp
@@ -1,3 +1,6 @@
+// Copyright (C) 2023-2024 Stdware Collections
+// SPDX-License-Identifier: Apache-2.0
+
 #include "styleagent.h"
 #include "styleagent_p.h"
 
@@ -5,12 +8,24 @@
 
 namespace QWK {
 
+    /*!
+        \class StyleAgent
+        \brief StyleAgent provides some features related to system theme.
+
+        Qt6.6 started to support system theme detection, this class is intended as an auxiliary
+        support for lower versions of Qt. If your Qt already supports it, it is recommended that
+        you don't include this class in your build system.
+    */
+
     StyleAgentPrivate::StyleAgentPrivate() {
     }
 
-    StyleAgentPrivate::~StyleAgentPrivate() = default;
+    StyleAgentPrivate::~StyleAgentPrivate() {
+        removeSystemThemeHook();
+    }
 
     void StyleAgentPrivate::init() {
+        setupSystemThemeHook();
     }
 
     void StyleAgentPrivate::notifyThemeChanged(StyleAgent::SystemTheme theme) {
@@ -22,25 +37,40 @@
         Q_EMIT q->systemThemeChanged();
     }
 
+    /*!
+        Constructor. Since it is not related to a concrete window instance, it is better to be used
+        as a singleton.
+    */
     StyleAgent::StyleAgent(QObject *parent) : StyleAgent(*new StyleAgentPrivate(), parent) {
-        Q_D(StyleAgent);
-        d->setupSystemThemeHook();
     }
 
+    /*!
+        Destructor.
+    */
     StyleAgent::~StyleAgent() {
-        Q_D(StyleAgent);
-        d->removeSystemThemeHook();
     }
 
+    /*!
+        Returns the system theme.
+    */
     StyleAgent::SystemTheme StyleAgent::systemTheme() const {
         Q_D(const StyleAgent);
         return d->systemTheme;
     }
 
+    /*!
+        \internal
+    */
     StyleAgent::StyleAgent(StyleAgentPrivate &d, QObject *parent) : QObject(parent), d_ptr(&d) {
         d.q_ptr = this;
 
         d.init();
     }
 
+    /*!
+        \fn void StyleAgent::systemThemeChanged()
+
+        This signal is emitted when the system theme changes.
+    */
+
 }

--
Gitblit v1.9.1