From ec2d6fb9ef359684fefda4f640f64ce2e7e6c89c Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sun, 9 Aug 2020 11:46:13 +0200 Subject: [PATCH] made the current theme writable via a property --- ScStwLibraries/headers/styling/scstwappthememanager.h | 2 ++ ScStwLibraries/sources/styling/scstwappthememanager.cpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/ScStwLibraries/headers/styling/scstwappthememanager.h b/ScStwLibraries/headers/styling/scstwappthememanager.h index bec5135..04b4ffb 100644 --- a/ScStwLibraries/headers/styling/scstwappthememanager.h +++ b/ScStwLibraries/headers/styling/scstwappthememanager.h @@ -27,6 +27,7 @@ class ScStwAppThemeManager : public QObject { Q_OBJECT Q_PROPERTY(ScStwAppTheme* theme READ getTheme NOTIFY themeChanged) + Q_PROPERTY(QString themeName READ getThemeName WRITE setTheme NOTIFY themeChanged) public: explicit ScStwAppThemeManager(QObject *parent = nullptr); @@ -45,6 +46,7 @@ signals: public slots: ScStwAppTheme* getTheme(); Q_INVOKABLE bool setTheme(QString themeName); + Q_INVOKABLE QString getThemeName(); }; diff --git a/ScStwLibraries/sources/styling/scstwappthememanager.cpp b/ScStwLibraries/sources/styling/scstwappthememanager.cpp index b8d3145..afa31c2 100644 --- a/ScStwLibraries/sources/styling/scstwappthememanager.cpp +++ b/ScStwLibraries/sources/styling/scstwappthememanager.cpp @@ -174,3 +174,7 @@ QString ScStwAppThemeManager::lighter(QString color, double factor) { qcolor.setHsv(h,s,v * factor); return qcolor.name(); } + +QString ScStwAppThemeManager::getThemeName() { + return this->currentTheme->getName(); +}