From 25681590025e152900c2f98a6ffe111cbfc2656d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Thu, 6 Apr 2023 11:15:29 +0800 Subject: Change mode type to bool for checking whether it's dark mode or not --- bootstrap.hxx | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'bootstrap.hxx') diff --git a/bootstrap.hxx b/bootstrap.hxx index b1c3f9c..e27499f 100644 --- a/bootstrap.hxx +++ b/bootstrap.hxx @@ -13,8 +13,8 @@ class BootstrapPlugin : public QQmlEngineExtensionPlugin class Bootstrap : public QObject { Q_OBJECT - Q_PROPERTY(Mode mode READ mode WRITE setMode NOTIFY modeChanged) Q_PROPERTY(Theme theme READ theme WRITE setTheme NOTIFY themeChanged) + Q_PROPERTY(bool darkMode READ darkMode WRITE setDarkMode NOTIFY darkModeChanged) Q_PROPERTY(QColor bodyBg READ bodyBg NOTIFY bodyBgChanged) QML_ELEMENT QML_UNCREATABLE("Bootstrap is an attached property") @@ -23,11 +23,6 @@ class Bootstrap : public QObject explicit Bootstrap(QObject *parent = nullptr); static Bootstrap *qmlAttachedProperties(QObject *object); - enum Mode { - LightMode, - DarkMode - }; - Q_ENUM(Mode) enum Theme { None, Primary, @@ -41,21 +36,20 @@ class Bootstrap : public QObject Link }; Q_ENUM(Theme) - - Mode mode() const; - void setMode(Mode mode); Theme theme() const; void setTheme(Theme theme); + bool darkMode() const; + void setDarkMode(bool darkMode); QColor bodyBg() const; signals: - void modeChanged(); void themeChanged(); + void darkModeChanged(); void bodyBgChanged(); private: - Mode bsMode; Theme bsTheme; + bool bsDarkMode; QColor bsLightBodyBg; QColor bsDarkBodyBg; }; -- cgit v1.2.3