From b91d4c63288dbad9f7785c099a9de982748112e2 Mon Sep 17 00:00:00 2001 From: johanneshilden Date: Fri, 29 Sep 2017 10:19:04 +0300 Subject: [PATCH] Use macro to disable theme colors in setters --- components/lib/qtmaterialcheckable.cpp | 12 ++++++++---- components/lib/qtmaterialstyle.h | 3 +++ components/qtmaterialavatar.cpp | 6 ++++-- components/qtmaterialbadge.cpp | 6 ++++-- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/components/lib/qtmaterialcheckable.cpp b/components/lib/qtmaterialcheckable.cpp index f2a92b1..9921f9e 100644 --- a/components/lib/qtmaterialcheckable.cpp +++ b/components/lib/qtmaterialcheckable.cpp @@ -179,7 +179,8 @@ void QtMaterialCheckable::setCheckedColor(const QColor &color) Q_D(QtMaterialCheckable); d->checkedColor = color; - setUseThemeColors(false); + + MATERIAL_DISABLE_THEME_COLORS setupProperties(); } @@ -199,7 +200,8 @@ void QtMaterialCheckable::setUncheckedColor(const QColor &color) Q_D(QtMaterialCheckable); d->uncheckedColor = color; - setUseThemeColors(false); + + MATERIAL_DISABLE_THEME_COLORS setupProperties(); } @@ -219,7 +221,8 @@ void QtMaterialCheckable::setTextColor(const QColor &color) Q_D(QtMaterialCheckable); d->textColor = color; - setUseThemeColors(false); + + MATERIAL_DISABLE_THEME_COLORS setupProperties(); } @@ -239,7 +242,8 @@ void QtMaterialCheckable::setDisabledColor(const QColor &color) Q_D(QtMaterialCheckable); d->disabledColor = color; - setUseThemeColors(false); + + MATERIAL_DISABLE_THEME_COLORS setupProperties(); } diff --git a/components/lib/qtmaterialstyle.h b/components/lib/qtmaterialstyle.h index db10353..e16289b 100644 --- a/components/lib/qtmaterialstyle.h +++ b/components/lib/qtmaterialstyle.h @@ -4,6 +4,9 @@ #include #include "lib/qtmaterialstyle_p.h" +#define MATERIAL_DISABLE_THEME_COLORS \ + if (d->useThemeColors == true) { d->useThemeColors = false; } + class QtMaterialTheme; class QtMaterialStyle : public QCommonStyle diff --git a/components/qtmaterialavatar.cpp b/components/qtmaterialavatar.cpp index 14277da..9d77734 100644 --- a/components/qtmaterialavatar.cpp +++ b/components/qtmaterialavatar.cpp @@ -109,7 +109,8 @@ void QtMaterialAvatar::setTextColor(const QColor &color) Q_D(QtMaterialAvatar); d->textColor = color; - setUseThemeColors(false); + + MATERIAL_DISABLE_THEME_COLORS update(); } @@ -129,7 +130,8 @@ void QtMaterialAvatar::setBackgroundColor(const QColor &color) Q_D(QtMaterialAvatar); d->backgroundColor = color; - setUseThemeColors(false); + + MATERIAL_DISABLE_THEME_COLORS update(); } diff --git a/components/qtmaterialbadge.cpp b/components/qtmaterialbadge.cpp index e125440..b30aa95 100644 --- a/components/qtmaterialbadge.cpp +++ b/components/qtmaterialbadge.cpp @@ -102,7 +102,8 @@ void QtMaterialBadge::setTextColor(const QColor &color) Q_D(QtMaterialBadge); d->textColor = color; - setUseThemeColors(false); + + MATERIAL_DISABLE_THEME_COLORS update(); } @@ -122,7 +123,8 @@ void QtMaterialBadge::setBackgroundColor(const QColor &color) Q_D(QtMaterialBadge); d->backgroundColor = color; - setUseThemeColors(false); + + MATERIAL_DISABLE_THEME_COLORS update(); }