avoid code duplication
This commit is contained in:
parent
29e6b2689d
commit
0229ce9891
|
@ -270,28 +270,7 @@ void FlatButton::paintEvent(QPaintEvent *event)
|
||||||
if (Qt::OpaqueMode == d->bgMode) {
|
if (Qt::OpaqueMode == d->bgMode) {
|
||||||
QBrush brush;
|
QBrush brush;
|
||||||
brush.setStyle(Qt::SolidPattern);
|
brush.setStyle(Qt::SolidPattern);
|
||||||
|
brush.setColor(backgroundColor());
|
||||||
QColor brushColor;
|
|
||||||
if (d->useThemeColors || !d->backgroundColor.isValid()) {
|
|
||||||
Style &style = Style::instance();
|
|
||||||
switch (d->role)
|
|
||||||
{
|
|
||||||
case Material::Primary:
|
|
||||||
brushColor = style.themeColor("primary1");
|
|
||||||
break;
|
|
||||||
case Material::Secondary:
|
|
||||||
brushColor = style.themeColor("accent1");
|
|
||||||
break;
|
|
||||||
case Material::Default:
|
|
||||||
default:
|
|
||||||
brushColor = style.themeColor("text");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
brushColor = d->backgroundColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
brush.setColor(brushColor);
|
|
||||||
painter.setOpacity(1);
|
painter.setOpacity(1);
|
||||||
painter.setBrush(brush);
|
painter.setBrush(brush);
|
||||||
painter.setPen(Qt::NoPen);
|
painter.setPen(Qt::NoPen);
|
||||||
|
|
Loading…
Reference in New Issue