forked from qt-creator/qt-creator
Utils: Make the "shadow" under toolbar icons optional
In preparation od a "Flat Light" theme, where shadows under the icons would have a negative impact. Change-Id: I2d9d3563c90336640513c1a970a432898dd63cfc Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
This commit is contained in:
committed by
Alessandro Portale
parent
5ff15e89f2
commit
abb63602de
@@ -188,6 +188,7 @@ ApplyThemePaletteGlobally=true
|
||||
FlatSideBarIcons=true
|
||||
FlatProjectsMode=true
|
||||
FlatMenuBar=true
|
||||
ToolBarIconShadow=true
|
||||
|
||||
[Gradients]
|
||||
DetailsWidgetHeaderGradient\1\color=0
|
||||
|
||||
@@ -182,6 +182,7 @@ ApplyThemePaletteGlobally=false
|
||||
FlatSideBarIcons=false
|
||||
FlatProjectsMode=false
|
||||
FlatMenuBar=false
|
||||
ToolBarIconShadow=true
|
||||
|
||||
[Gradients]
|
||||
DetailsWidgetHeaderGradient\1\color=ffffff
|
||||
|
||||
@@ -192,6 +192,7 @@ ApplyThemePaletteGlobally=false
|
||||
FlatSideBarIcons=true
|
||||
FlatProjectsMode=false
|
||||
FlatMenuBar=false
|
||||
ToolBarIconShadow=true
|
||||
|
||||
[Gradients]
|
||||
DetailsWidgetHeaderGradient\1\color=0
|
||||
|
||||
@@ -129,7 +129,7 @@ static QPixmap masksToIcon(const MasksAndColors &masks, const QPixmap &combinedM
|
||||
p.drawPixmap(0, 0, maskToColorAndAlpha((*maskImage).first, (*maskImage).second));
|
||||
}
|
||||
|
||||
if (style & Icon::DropShadow) {
|
||||
if (style & Icon::DropShadow && creatorTheme()->flag(Theme::ToolBarIconShadow)) {
|
||||
const QPixmap shadowMask = maskToColorAndAlpha(combinedMask, Qt::black);
|
||||
p.setCompositionMode(QPainter::CompositionMode_DestinationOver);
|
||||
p.setOpacity(0.05);
|
||||
|
||||
@@ -315,7 +315,8 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
|
||||
if (!enabled) {
|
||||
drawCommonStyleArrow(image.rect(), creatorTheme()->color(Theme::IconsDisabledColor));
|
||||
} else {
|
||||
drawCommonStyleArrow(image.rect().translated(0, devicePixelRatio), toolBarDropShadowColor());
|
||||
if (creatorTheme()->flag(Theme::ToolBarIconShadow))
|
||||
drawCommonStyleArrow(image.rect().translated(0, devicePixelRatio), toolBarDropShadowColor());
|
||||
drawCommonStyleArrow(image.rect(), creatorTheme()->color(Theme::IconsBaseColor));
|
||||
}
|
||||
painter.end();
|
||||
@@ -393,7 +394,7 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect,
|
||||
const bool hasDisabledState = icon.availableSizes(QIcon::Disabled).contains(px.size());
|
||||
if (!hasDisabledState)
|
||||
px = disabledSideBarIcon(icon.pixmap(window, rect.size()));
|
||||
} else {
|
||||
} else if (creatorTheme()->flag(Theme::ToolBarIconShadow)) {
|
||||
// Draw shadow
|
||||
QImage tmp(px.size() + QSize(radius * 2, radius * 2 + 1), QImage::Format_ARGB32_Premultiplied);
|
||||
tmp.fill(Qt::transparent);
|
||||
|
||||
@@ -274,7 +274,8 @@ public:
|
||||
ApplyThemePaletteGlobally,
|
||||
FlatSideBarIcons,
|
||||
FlatProjectsMode,
|
||||
FlatMenuBar
|
||||
FlatMenuBar,
|
||||
ToolBarIconShadow
|
||||
};
|
||||
|
||||
enum WidgetStyle {
|
||||
|
||||
Reference in New Issue
Block a user