Flat and themeable side bar icons

This patch adds flat side bar icons according to
http://blog.qt.io/blog/author/didesous/

The flat icons are supposed to be opt-in, via the theme flag
"FlatSideBarIcons=true". It is false by default for the default
theme for now.

Change-Id: I1cbe69d4e138d5d23c0172a374933ac7a4ce8a5b
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
This commit is contained in:
Alessandro Portale
2015-11-11 19:26:58 +01:00
parent 0f50c41d05
commit 37c1823974
61 changed files with 654 additions and 74 deletions

View File

@@ -182,6 +182,8 @@ void FancyToolButton::paintEvent(QPaintEvent *event)
painter.restore();
}
const QIcon::Mode iconMode = isEnabled() ? ((isDown() || isChecked()) ? QIcon::Active : QIcon::Normal)
: QIcon::Disabled;
QRect iconRect(0, 0, Constants::TARGET_ICON_SIZE, Constants::TARGET_ICON_SIZE);
// draw popup texts
if (isTitledAction) {
@@ -203,7 +205,7 @@ void FancyToolButton::paintEvent(QPaintEvent *event)
centerRect.adjust(0, 0, 0, -lineHeight*2 - 4);
iconRect.moveCenter(centerRect.center());
StyleHelper::drawIconWithShadow(icon(), iconRect, &painter, isEnabled() ? QIcon::Normal : QIcon::Disabled);
StyleHelper::drawIconWithShadow(icon(), iconRect, &painter, iconMode);
painter.setFont(normalFont);
QPoint textOffset = centerRect.center() - QPoint(iconRect.width()/2, iconRect.height()/2);
@@ -264,7 +266,7 @@ void FancyToolButton::paintEvent(QPaintEvent *event)
}
} else {
iconRect.moveCenter(rect().center());
StyleHelper::drawIconWithShadow(icon(), iconRect, &painter, isEnabled() ? QIcon::Normal : QIcon::Disabled);
StyleHelper::drawIconWithShadow(icon(), iconRect, &painter, iconMode);
}
}