From af550776635edbdf850ba731280d381b1044797c 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: Tue, 2 May 2023 16:17:48 +0700 Subject: Card background colours --- Bootstrap.cxx | 10 +++++++++- Bootstrap.hxx | 5 +++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Bootstrap.cxx b/Bootstrap.cxx index f86b0ae..92fa469 100644 --- a/Bootstrap.cxx +++ b/Bootstrap.cxx @@ -69,7 +69,8 @@ Bootstrap::Bootstrap(QObject *parent): h3FontSize{{20.8, .006}}, h4FontSize{{20.4, .003}}, h5FontSize{{20.0, .0}}, - h6FontSize{{16.0, .0}} + h6FontSize{{16.0, .0}}, + cardBgs{{bodyBgs.at(0), bodyBgs.at(1)}} { bsBodyFont.setStyleHint(QFont::SansSerif); bsBodyFont.setPointSizeF(16.0); @@ -113,6 +114,7 @@ Bootstrap::Bootstrap(QObject *parent): OVERRIDE_HX_FONT_SIZE("H4FontSize", h4FontSize); OVERRIDE_HX_FONT_SIZE("H5FontSize", h5FontSize); OVERRIDE_HX_FONT_SIZE("H6FontSize", h6FontSize); + OVERRIDE_COLORS("CardBgs", cardBgs); toml_free(toml); @@ -148,6 +150,7 @@ void Bootstrap::setMode(Mode mode) emit bodyBgChanged(); emit borderColorChanged(); emit headingColorChanged(); + emit cardBgChanged(); for (auto sibling : parent()->findChildren()) if (strstr(sibling->metaObject()->className(), "_QMLTYPE_")) for (auto child : sibling->children()) @@ -235,3 +238,8 @@ QColor Bootstrap::headingColor() const { return headingColors.at(static_cast(bsMode)); } + +QColor Bootstrap::cardBg() const +{ + return cardBgs.at(static_cast(bsMode)); +} diff --git a/Bootstrap.hxx b/Bootstrap.hxx index 320f76c..ce8a907 100644 --- a/Bootstrap.hxx +++ b/Bootstrap.hxx @@ -29,6 +29,7 @@ class Bootstrap : public QObject Q_PROPERTY(QFont headingFont READ headingFont NOTIFY headingFontChanged) Q_PROPERTY(QColor headingColor READ headingColor NOTIFY headingColorChanged) + Q_PROPERTY(QColor cardBg READ cardBg NOTIFY cardBgChanged) QML_ELEMENT QML_UNCREATABLE("Bootstrap is an attached property") @@ -72,6 +73,8 @@ class Bootstrap : public QObject Q_INVOKABLE qreal headingFontSize(const qreal parentWidth = .0); QColor headingColor() const; + QColor cardBg() const; + signals: void themeChanged(); void modeChanged(); @@ -83,6 +86,7 @@ class Bootstrap : public QObject void headingChanged(); void headingFontChanged(); void headingColorChanged(); + void cardBgChanged(); private: Mode bsMode; @@ -101,6 +105,7 @@ class Bootstrap : public QObject QVector h4FontSize; QVector h5FontSize; QVector h6FontSize; + QVector cardBgs; }; QML_DECLARE_TYPEINFO(Bootstrap, QML_HAS_ATTACHED_PROPERTIES) -- cgit v1.2.3