diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-04-06 08:24:59 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-04-06 08:24:59 +0800 |
commit | 76a00c3d08d582422b5b0b9b38880218054f6e93 (patch) | |
tree | 90586eb1b5160eef930b43b83311e10721df17f0 /bootstrap.hxx | |
parent | a0096545d2bffc622167d3164c328af8308cc93b (diff) |
Bootstrap is an attached property
Diffstat (limited to 'bootstrap.hxx')
-rw-r--r-- | bootstrap.hxx | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/bootstrap.hxx b/bootstrap.hxx index dc1a1dd..2297be0 100644 --- a/bootstrap.hxx +++ b/bootstrap.hxx @@ -2,18 +2,35 @@ #define BOOTSTRAP_HXX #include <QtQml> +#include <QColor> -class Bootstrap : public QQmlEngineExtensionPlugin +class BootstrapPlugin : public QQmlEngineExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) - Q_PROPERTY(Purpose purpose READ purpose WRITE setPurpose NOTIFY purposeChanged) +}; + +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(QColor bodyBg READ bodyBg NOTIFY bodyBgChanged) + Q_PROPERTY(QColor lightBodyBg WRITE setLightBodyBg) + Q_PROPERTY(QColor darkBodyBg WRITE setDarkBodyBg) + QML_ELEMENT + QML_UNCREATABLE("Bootstrap is an attached property") public: explicit Bootstrap(QObject *parent = nullptr); static Bootstrap *qmlAttachedProperties(QObject *object); - enum Purpose { + enum Mode { + LightMode, + DarkMode + }; + Q_ENUM(Mode) + enum Theme { None, Primary, Secondary, @@ -25,15 +42,26 @@ class Bootstrap : public QQmlEngineExtensionPlugin Dark, Link }; - Q_ENUM(Purpose) - Purpose purpose() const; - void setPurpose(Purpose purpose); + Q_ENUM(Theme) + + Mode mode() const; + void setMode(Mode mode); + Theme theme() const; + void setTheme(Theme theme); + QColor bodyBg() const; + void setLightBodyBg(QColor lightBodyBg); + void setDarkBodyBg(QColor darkBodyBg); signals: - void purposeChanged(); + void modeChanged(); + void themeChanged(); + void bodyBgChanged(); private: - Purpose m_purpose; + Mode bs_mode; + Theme bs_theme; + QColor bs_lightBodyBg; + QColor bs_darkBodyBg; }; QML_DECLARE_TYPEINFO(Bootstrap, QML_HAS_ATTACHED_PROPERTIES) |