Use macro to disable theme colors in setters

This commit is contained in:
johanneshilden 2017-09-29 10:19:04 +03:00
parent ae358e888c
commit b91d4c6328
4 changed files with 19 additions and 8 deletions

View File

@ -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();
}

View File

@ -4,6 +4,9 @@
#include <QtWidgets/QCommonStyle>
#include "lib/qtmaterialstyle_p.h"
#define MATERIAL_DISABLE_THEME_COLORS \
if (d->useThemeColors == true) { d->useThemeColors = false; }
class QtMaterialTheme;
class QtMaterialStyle : public QCommonStyle

View File

@ -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();
}

View File

@ -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();
}