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
|
FlatSideBarIcons=true
|
||||||
FlatProjectsMode=true
|
FlatProjectsMode=true
|
||||||
FlatMenuBar=true
|
FlatMenuBar=true
|
||||||
|
ToolBarIconShadow=true
|
||||||
|
|
||||||
[Gradients]
|
[Gradients]
|
||||||
DetailsWidgetHeaderGradient\1\color=0
|
DetailsWidgetHeaderGradient\1\color=0
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ ApplyThemePaletteGlobally=false
|
|||||||
FlatSideBarIcons=false
|
FlatSideBarIcons=false
|
||||||
FlatProjectsMode=false
|
FlatProjectsMode=false
|
||||||
FlatMenuBar=false
|
FlatMenuBar=false
|
||||||
|
ToolBarIconShadow=true
|
||||||
|
|
||||||
[Gradients]
|
[Gradients]
|
||||||
DetailsWidgetHeaderGradient\1\color=ffffff
|
DetailsWidgetHeaderGradient\1\color=ffffff
|
||||||
|
|||||||
@@ -192,6 +192,7 @@ ApplyThemePaletteGlobally=false
|
|||||||
FlatSideBarIcons=true
|
FlatSideBarIcons=true
|
||||||
FlatProjectsMode=false
|
FlatProjectsMode=false
|
||||||
FlatMenuBar=false
|
FlatMenuBar=false
|
||||||
|
ToolBarIconShadow=true
|
||||||
|
|
||||||
[Gradients]
|
[Gradients]
|
||||||
DetailsWidgetHeaderGradient\1\color=0
|
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));
|
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);
|
const QPixmap shadowMask = maskToColorAndAlpha(combinedMask, Qt::black);
|
||||||
p.setCompositionMode(QPainter::CompositionMode_DestinationOver);
|
p.setCompositionMode(QPainter::CompositionMode_DestinationOver);
|
||||||
p.setOpacity(0.05);
|
p.setOpacity(0.05);
|
||||||
|
|||||||
@@ -315,6 +315,7 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
|
|||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
drawCommonStyleArrow(image.rect(), creatorTheme()->color(Theme::IconsDisabledColor));
|
drawCommonStyleArrow(image.rect(), creatorTheme()->color(Theme::IconsDisabledColor));
|
||||||
} else {
|
} else {
|
||||||
|
if (creatorTheme()->flag(Theme::ToolBarIconShadow))
|
||||||
drawCommonStyleArrow(image.rect().translated(0, devicePixelRatio), toolBarDropShadowColor());
|
drawCommonStyleArrow(image.rect().translated(0, devicePixelRatio), toolBarDropShadowColor());
|
||||||
drawCommonStyleArrow(image.rect(), creatorTheme()->color(Theme::IconsBaseColor));
|
drawCommonStyleArrow(image.rect(), creatorTheme()->color(Theme::IconsBaseColor));
|
||||||
}
|
}
|
||||||
@@ -393,7 +394,7 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect,
|
|||||||
const bool hasDisabledState = icon.availableSizes(QIcon::Disabled).contains(px.size());
|
const bool hasDisabledState = icon.availableSizes(QIcon::Disabled).contains(px.size());
|
||||||
if (!hasDisabledState)
|
if (!hasDisabledState)
|
||||||
px = disabledSideBarIcon(icon.pixmap(window, rect.size()));
|
px = disabledSideBarIcon(icon.pixmap(window, rect.size()));
|
||||||
} else {
|
} else if (creatorTheme()->flag(Theme::ToolBarIconShadow)) {
|
||||||
// Draw shadow
|
// Draw shadow
|
||||||
QImage tmp(px.size() + QSize(radius * 2, radius * 2 + 1), QImage::Format_ARGB32_Premultiplied);
|
QImage tmp(px.size() + QSize(radius * 2, radius * 2 + 1), QImage::Format_ARGB32_Premultiplied);
|
||||||
tmp.fill(Qt::transparent);
|
tmp.fill(Qt::transparent);
|
||||||
|
|||||||
@@ -274,7 +274,8 @@ public:
|
|||||||
ApplyThemePaletteGlobally,
|
ApplyThemePaletteGlobally,
|
||||||
FlatSideBarIcons,
|
FlatSideBarIcons,
|
||||||
FlatProjectsMode,
|
FlatProjectsMode,
|
||||||
FlatMenuBar
|
FlatMenuBar,
|
||||||
|
ToolBarIconShadow
|
||||||
};
|
};
|
||||||
|
|
||||||
enum WidgetStyle {
|
enum WidgetStyle {
|
||||||
|
|||||||
Reference in New Issue
Block a user