From c7a019ddcd164ecfbf82be6129967c96be2667d5 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 12:19:31 +0800 Subject: Rename the files --- Bootstrap.hxx | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Bootstrap.hxx (limited to 'Bootstrap.hxx') diff --git a/Bootstrap.hxx b/Bootstrap.hxx new file mode 100644 index 0000000..eecbda6 --- /dev/null +++ b/Bootstrap.hxx @@ -0,0 +1,59 @@ +#ifndef BOOTSTRAP_HXX +#define BOOTSTRAP_HXX + +#include +#include + +class Qootstrap : public QQmlEngineExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) +}; + +class Bootstrap : public QObject +{ + Q_OBJECT + 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") + + public: + explicit Bootstrap(QObject *parent = nullptr); + static Bootstrap *qmlAttachedProperties(QObject *object); + + enum Theme { + None, + Primary, + Secondary, + Success, + Danger, + Warning, + Info, + Light, + Dark, + Link + }; + Q_ENUM(Theme) + Theme theme() const; + void setTheme(Theme theme); + bool darkMode() const; + void setDarkMode(bool darkMode); + QColor bodyBg() const; + + signals: + void themeChanged(); + void darkModeChanged(); + void bodyBgChanged(); + + private: + Theme bsTheme; + bool bsDarkMode; + QColor bsLightBodyBg; + QColor bsDarkBodyBg; +}; + +QML_DECLARE_TYPEINFO(Bootstrap, QML_HAS_ATTACHED_PROPERTIES) + +#endif -- cgit v1.2.3