Utils: Replace Theme::widgetStyle with a flag

Theme::widgetStyle with its two possible return values makes less sense
than a bool flag. Especially since we already have several separate
theme flags for ui elements which might be "flat" or not.

Change-Id: Ic521bb58c04386b735b784079de05e521bc1f45f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Alessandro Portale
2016-06-15 17:41:33 +02:00
committed by Alessandro Portale
parent eeadfbba8c
commit 8588cf268f
17 changed files with 56 additions and 85 deletions

View File

@@ -185,6 +185,7 @@ DrawSearchResultWidgetFrame=false
DrawTargetSelectorBottom=false DrawTargetSelectorBottom=false
DrawToolBarHighlights=true DrawToolBarHighlights=true
ApplyThemePaletteGlobally=true ApplyThemePaletteGlobally=true
FlatToolBars=true
FlatSideBarIcons=true FlatSideBarIcons=true
FlatProjectsMode=true FlatProjectsMode=true
FlatMenuBar=true FlatMenuBar=true
@@ -208,6 +209,3 @@ BuildStepDisable=:/projectexplorer/images/lightdisabledbuildstep.png
BuildStepRemove=:/core/images/lightclose.png BuildStepRemove=:/core/images/lightclose.png
BuildStepMoveDown=:/core/images/lightarrowdown.png BuildStepMoveDown=:/core/images/lightarrowdown.png
BuildStepMoveUp=:/core/images/lightarrowup.png BuildStepMoveUp=:/core/images/lightarrowup.png
[Style]
WidgetStyle=StyleFlat

View File

@@ -179,6 +179,7 @@ DrawSearchResultWidgetFrame=true
DrawTargetSelectorBottom=true DrawTargetSelectorBottom=true
DrawToolBarHighlights=true DrawToolBarHighlights=true
ApplyThemePaletteGlobally=false ApplyThemePaletteGlobally=false
FlatToolBars=false
FlatSideBarIcons=false FlatSideBarIcons=false
FlatProjectsMode=false FlatProjectsMode=false
FlatMenuBar=false FlatMenuBar=false
@@ -188,6 +189,3 @@ ToolBarIconShadow=true
DetailsWidgetHeaderGradient\1\color=ffffff DetailsWidgetHeaderGradient\1\color=ffffff
DetailsWidgetHeaderGradient\1\pos=1 DetailsWidgetHeaderGradient\1\pos=1
DetailsWidgetHeaderGradient\size=1 DetailsWidgetHeaderGradient\size=1
[Style]
WidgetStyle=StyleDefault

View File

@@ -189,6 +189,7 @@ DrawSearchResultWidgetFrame=false
DrawTargetSelectorBottom=false DrawTargetSelectorBottom=false
DrawToolBarHighlights=false DrawToolBarHighlights=false
ApplyThemePaletteGlobally=false ApplyThemePaletteGlobally=false
FlatToolBars=true
FlatSideBarIcons=true FlatSideBarIcons=true
FlatProjectsMode=false FlatProjectsMode=false
FlatMenuBar=false FlatMenuBar=false
@@ -198,6 +199,3 @@ ToolBarIconShadow=true
DetailsWidgetHeaderGradient\1\color=0 DetailsWidgetHeaderGradient\1\color=0
DetailsWidgetHeaderGradient\1\pos=1 DetailsWidgetHeaderGradient\1\pos=1
DetailsWidgetHeaderGradient\size=1 DetailsWidgetHeaderGradient\size=1
[Style]
WidgetStyle=StyleFlat

View File

@@ -39,7 +39,6 @@ namespace Utils {
static Theme *m_creatorTheme = 0; static Theme *m_creatorTheme = 0;
ThemePrivate::ThemePrivate() ThemePrivate::ThemePrivate()
: widgetStyle(Theme::StyleDefault)
{ {
const QMetaObject &m = Theme::staticMetaObject; const QMetaObject &m = Theme::staticMetaObject;
colors.resize (m.enumerator(m.indexOfEnumerator("Color")).keyCount()); colors.resize (m.enumerator(m.indexOfEnumerator("Color")).keyCount());
@@ -73,11 +72,6 @@ Theme::~Theme()
delete d; delete d;
} }
Theme::WidgetStyle Theme::widgetStyle() const
{
return d->widgetStyle;
}
QStringList Theme::preferredStyles() const QStringList Theme::preferredStyles() const
{ {
return d->preferredStyles; return d->preferredStyles;
@@ -164,10 +158,6 @@ QVariantHash Theme::values() const
result.insert(key, flag(static_cast<Theme::Flag>(i))); result.insert(key, flag(static_cast<Theme::Flag>(i)));
} }
} }
{
const QMetaEnum e = m.enumerator(m.indexOfEnumerator("WidgetStyle"));
result.insert(QLatin1String("WidgetStyle"), QLatin1String(e.valueToKey(widgetStyle())));
}
return result; return result;
} }
@@ -198,13 +188,6 @@ void Theme::readSettings(QSettings &settings)
} }
settings.endGroup(); settings.endGroup();
} }
{
settings.beginGroup(QLatin1String("Style"));
QMetaEnum e = m.enumerator(m.indexOfEnumerator("WidgetStyle"));
QString val = settings.value(QLatin1String("WidgetStyle")).toString();
d->widgetStyle = static_cast<Theme::WidgetStyle>(e.keysToValue (val.toLatin1().data()));
settings.endGroup();
}
{ {
settings.beginGroup(QLatin1String("Colors")); settings.beginGroup(QLatin1String("Colors"));
QMetaEnum e = m.enumerator(m.indexOfEnumerator("Color")); QMetaEnum e = m.enumerator(m.indexOfEnumerator("Color"));

View File

@@ -272,18 +272,13 @@ public:
ComboBoxDrawTextShadow, ComboBoxDrawTextShadow,
DerivePaletteFromTheme, DerivePaletteFromTheme,
ApplyThemePaletteGlobally, ApplyThemePaletteGlobally,
FlatToolBars,
FlatSideBarIcons, FlatSideBarIcons,
FlatProjectsMode, FlatProjectsMode,
FlatMenuBar, FlatMenuBar,
ToolBarIconShadow ToolBarIconShadow
}; };
enum WidgetStyle {
StyleDefault,
StyleFlat
};
WidgetStyle widgetStyle() const;
bool flag(Flag f) const; bool flag(Flag f) const;
QColor color(Color role) const; QColor color(Color role) const;
QString imageFile(ImageFile imageFile, const QString &fallBack) const; QString imageFile(ImageFile imageFile, const QString &fallBack) const;

View File

@@ -47,7 +47,6 @@ public:
QVector<QString> imageFiles; QVector<QString> imageFiles;
QVector<QGradientStops> gradients; QVector<QGradientStops> gradients;
QVector<bool> flags; QVector<bool> flags;
Theme::WidgetStyle widgetStyle;
QMap<QString, QColor> palette; QMap<QString, QColor> palette;
}; };

View File

@@ -291,14 +291,14 @@ void EditorView::paintEvent(QPaintEvent *)
QPainter painter(this); QPainter painter(this);
QRect rect = m_container->geometry(); QRect rect = m_container->geometry();
if (creatorTheme()->widgetStyle() == Theme::StyleDefault) { if (creatorTheme()->flag(Theme::FlatToolBars)) {
painter.fillRect(rect, creatorTheme()->color(Theme::EditorPlaceholderColor));
} else {
painter.setRenderHint(QPainter::Antialiasing, true); painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(Qt::NoPen); painter.setPen(Qt::NoPen);
painter.setBrush(creatorTheme()->color(Theme::EditorPlaceholderColor)); painter.setBrush(creatorTheme()->color(Theme::EditorPlaceholderColor));
const int r = 3; const int r = 3;
painter.drawRoundedRect(rect.adjusted(r , r, -r, -r), r * 2, r * 2); painter.drawRoundedRect(rect.adjusted(r , r, -r, -r), r * 2, r * 2);
} else {
painter.fillRect(rect, creatorTheme()->color(Theme::EditorPlaceholderColor));
} }
} }

View File

@@ -145,20 +145,22 @@ void FancyToolButton::paintEvent(QPaintEvent *event)
if (!HostOsInfo::isMacHost() // Mac UIs usually don't hover if (!HostOsInfo::isMacHost() // Mac UIs usually don't hover
&& m_fader > 0 && isEnabled() && !isDown() && !isChecked()) { && m_fader > 0 && isEnabled() && !isDown() && !isChecked()) {
painter.save(); painter.save();
if (creatorTheme()->widgetStyle() == Theme::StyleDefault) { if (creatorTheme()->flag(Theme::FlatToolBars)) {
painter.setOpacity(m_fader);
FancyToolButton::hoverOverlay(&painter, rect());
} else {
const QColor hoverColor = creatorTheme()->color(Theme::FancyToolButtonHoverColor); const QColor hoverColor = creatorTheme()->color(Theme::FancyToolButtonHoverColor);
QColor fadedHoverColor = hoverColor; QColor fadedHoverColor = hoverColor;
fadedHoverColor.setAlpha(int(m_fader * hoverColor.alpha())); fadedHoverColor.setAlpha(int(m_fader * hoverColor.alpha()));
painter.fillRect(rect(), fadedHoverColor); painter.fillRect(rect(), fadedHoverColor);
} else {
painter.setOpacity(m_fader);
FancyToolButton::hoverOverlay(&painter, rect());
} }
painter.restore(); painter.restore();
} else if (isDown() || isChecked()) { } else if (isDown() || isChecked()) {
painter.save(); painter.save();
const QColor selectedColor = creatorTheme()->color(Theme::FancyToolButtonSelectedColor); const QColor selectedColor = creatorTheme()->color(Theme::FancyToolButtonSelectedColor);
if (creatorTheme()->widgetStyle() == Theme::StyleDefault) { if (creatorTheme()->flag(Theme::FlatToolBars)) {
painter.fillRect(rect(), selectedColor);
} else {
QLinearGradient grad(rect().topLeft(), rect().topRight()); QLinearGradient grad(rect().topLeft(), rect().topRight());
grad.setColorAt(0, Qt::transparent); grad.setColorAt(0, Qt::transparent);
grad.setColorAt(0.5, selectedColor); grad.setColorAt(0.5, selectedColor);
@@ -171,8 +173,6 @@ void FancyToolButton::paintEvent(QPaintEvent *event)
painter.drawLine(borderRectF.topLeft() + QPointF(0, 1), borderRectF.topRight() + QPointF(0, 1)); painter.drawLine(borderRectF.topLeft() + QPointF(0, 1), borderRectF.topRight() + QPointF(0, 1));
painter.drawLine(borderRectF.bottomLeft(), borderRectF.bottomRight()); painter.drawLine(borderRectF.bottomLeft(), borderRectF.bottomRight());
painter.drawLine(borderRectF.bottomLeft(), borderRectF.bottomRight()); painter.drawLine(borderRectF.bottomLeft(), borderRectF.bottomRight());
} else {
painter.fillRect(rect(), selectedColor);
} }
painter.restore(); painter.restore();
} }
@@ -269,7 +269,7 @@ void FancyActionBar::paintEvent(QPaintEvent *event)
{ {
QPainter painter(this); QPainter painter(this);
const QRectF borderRect = QRectF(rect()).adjusted(0.5, 0.5, -0.5, -0.5); const QRectF borderRect = QRectF(rect()).adjusted(0.5, 0.5, -0.5, -0.5);
if (creatorTheme()->widgetStyle () == Theme::StyleFlat) { if (creatorTheme()->flag(Theme::FlatToolBars)) {
// this paints the background of the bottom portion of the // this paints the background of the bottom portion of the
// left tab bar // left tab bar
painter.fillRect(event->rect(), StyleHelper::baseColor()); painter.fillRect(event->rect(), StyleHelper::baseColor());

View File

@@ -114,7 +114,7 @@ QSize FancyTabBar::tabSizeHint(bool minimum) const
void FancyTabBar::paintEvent(QPaintEvent *event) void FancyTabBar::paintEvent(QPaintEvent *event)
{ {
QPainter p(this); QPainter p(this);
if (creatorTheme()->widgetStyle() == Theme::StyleFlat) { if (creatorTheme()->flag(Theme::FlatToolBars)) {
// draw background of upper part of left tab widget // draw background of upper part of left tab widget
// (Welcome, ... Help) // (Welcome, ... Help)
p.fillRect(event->rect(), StyleHelper::baseColor()); p.fillRect(event->rect(), StyleHelper::baseColor());
@@ -293,7 +293,7 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const
bool enabled = isTabEnabled(tabIndex); bool enabled = isTabEnabled(tabIndex);
if (selected) { if (selected) {
if (creatorTheme()->widgetStyle() == Theme::StyleFlat) { if (creatorTheme()->flag(Theme::FlatToolBars)) {
// background color of a fancy tab that is active // background color of a fancy tab that is active
painter->fillRect(rect, creatorTheme()->color(Theme::FancyToolButtonSelectedColor)); painter->fillRect(rect, creatorTheme()->color(Theme::FancyToolButtonSelectedColor));
} else { } else {
@@ -317,14 +317,14 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const
if (fader > 0 && !HostOsInfo::isMacHost() && !selected && enabled) { if (fader > 0 && !HostOsInfo::isMacHost() && !selected && enabled) {
painter->save(); painter->save();
painter->setOpacity(fader); painter->setOpacity(fader);
if (creatorTheme()->widgetStyle() == Theme::StyleFlat) if (creatorTheme()->flag(Theme::FlatToolBars))
painter->fillRect(rect, creatorTheme()->color(Theme::FancyToolButtonHoverColor)); painter->fillRect(rect, creatorTheme()->color(Theme::FancyToolButtonHoverColor));
else else
FancyToolButton::hoverOverlay(painter, rect); FancyToolButton::hoverOverlay(painter, rect);
painter->restore(); painter->restore();
} }
if (!enabled && creatorTheme()->widgetStyle() == Theme::StyleDefault) if (!enabled && !creatorTheme()->flag(Theme::FlatToolBars))
painter->setOpacity(0.7); painter->setOpacity(0.7);
if (drawIcon) { if (drawIcon) {

View File

@@ -455,7 +455,13 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
// Fill the line edit background // Fill the line edit background
QRectF backgroundRect = option->rect; QRectF backgroundRect = option->rect;
const bool enabled = option->state & State_Enabled; const bool enabled = option->state & State_Enabled;
if (Utils::creatorTheme()->widgetStyle() == Utils::Theme::StyleDefault) { if (Utils::creatorTheme()->flag(Theme::FlatToolBars)) {
painter->save();
if (!enabled)
painter->setOpacity(0.75);
painter->fillRect(backgroundRect, option->palette.base());
painter->restore();
} else {
backgroundRect.adjust(1, 1, -1, -1); backgroundRect.adjust(1, 1, -1, -1);
painter->setBrushOrigin(backgroundRect.topLeft()); painter->setBrushOrigin(backgroundRect.topLeft());
painter->fillRect(backgroundRect, option->palette.base()); painter->fillRect(backgroundRect, option->palette.base());
@@ -467,12 +473,6 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
StyleHelper::drawCornerImage(enabled ? bg : bg_disabled, StyleHelper::drawCornerImage(enabled ? bg : bg_disabled,
painter, option->rect, 5, 5, 5, 5); painter, option->rect, 5, 5, 5, 5);
} else {
painter->save();
if (!enabled)
painter->setOpacity(0.75);
painter->fillRect(backgroundRect, option->palette.base());
painter->restore();
} }
const bool hasFocus = state & State_HasFocus; const bool hasFocus = state & State_HasFocus;
@@ -499,7 +499,7 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
if (pressed) { if (pressed) {
const QColor shade = creatorTheme()->color(Theme::FancyToolButtonSelectedColor); const QColor shade = creatorTheme()->color(Theme::FancyToolButtonSelectedColor);
painter->fillRect(rect, shade); painter->fillRect(rect, shade);
if (creatorTheme()->widgetStyle() == Theme::StyleDefault) { if (!creatorTheme()->flag(Theme::FlatToolBars)) {
const QRectF borderRect = QRectF(rect).adjusted(0.5, 0.5, -0.5, -0.5); const QRectF borderRect = QRectF(rect).adjusted(0.5, 0.5, -0.5, -0.5);
painter->drawLine(borderRect.topLeft() + QPointF(1, 0), borderRect.topRight() - QPointF(1, 0)); painter->drawLine(borderRect.topLeft() + QPointF(1, 0), borderRect.topRight() - QPointF(1, 0));
painter->drawLine(borderRect.topLeft(), borderRect.bottomLeft()); painter->drawLine(borderRect.topLeft(), borderRect.bottomLeft());
@@ -527,7 +527,9 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
case PE_PanelStatusBar: case PE_PanelStatusBar:
{ {
if (creatorTheme()->widgetStyle() == Theme::StyleDefault) { if (creatorTheme()->flag(Theme::FlatToolBars)) {
painter->fillRect(rect, StyleHelper::baseColor());
} else {
painter->save(); painter->save();
QLinearGradient grad = StyleHelper::statusBarGradient(rect); QLinearGradient grad = StyleHelper::statusBarGradient(rect);
painter->fillRect(rect, grad); painter->fillRect(rect, grad);
@@ -538,8 +540,6 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
painter->setPen(StyleHelper::borderColor().darker(110)); //TODO: make themable painter->setPen(StyleHelper::borderColor().darker(110)); //TODO: make themable
painter->drawLine(borderRect.topLeft(), borderRect.topRight()); painter->drawLine(borderRect.topLeft(), borderRect.topRight());
painter->restore(); painter->restore();
} else {
painter->fillRect(rect, StyleHelper::baseColor());
} }
} }
break; break;
@@ -819,7 +819,7 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
bool drawLightColored = lightColored(widget); bool drawLightColored = lightColored(widget);
// draws the background of the 'Type hierarchy', 'Projects' headers // draws the background of the 'Type hierarchy', 'Projects' headers
if (creatorTheme()->widgetStyle() == Theme::StyleFlat) if (creatorTheme()->flag(Theme::FlatToolBars))
painter->fillRect(rect, StyleHelper::baseColor(drawLightColored)); painter->fillRect(rect, StyleHelper::baseColor(drawLightColored));
else if (horizontal) else if (horizontal)
StyleHelper::horizontalGradient(painter, gradientSpan, rect, drawLightColored); StyleHelper::horizontalGradient(painter, gradientSpan, rect, drawLightColored);
@@ -836,9 +836,9 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
// Note: This is a hack to determine if the // Note: This is a hack to determine if the
// toolbar should draw the top or bottom outline // toolbar should draw the top or bottom outline
// (needed for the find toolbar for instance) // (needed for the find toolbar for instance)
const QColor hightLight = creatorTheme()->widgetStyle() == Theme::StyleDefault const QColor hightLight = creatorTheme()->flag(Theme::FlatToolBars)
? StyleHelper::sidebarHighlight() ? creatorTheme()->color(Theme::FancyToolBarSeparatorColor)
: creatorTheme()->color(Theme::FancyToolBarSeparatorColor); : StyleHelper::sidebarHighlight();
const QColor borderColor = drawLightColored const QColor borderColor = drawLightColored
? QColor(255, 255, 255, 180) : hightLight; ? QColor(255, 255, 255, 180) : hightLight;
if (widget && widget->property("topBorder").toBool()) { if (widget && widget->property("topBorder").toBool()) {
@@ -1017,7 +1017,7 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti
void ManhattanStyle::drawButtonSeparator(QPainter *painter, const QRect &rect, bool reverse) const void ManhattanStyle::drawButtonSeparator(QPainter *painter, const QRect &rect, bool reverse) const
{ {
const QRectF borderRect = QRectF(rect).adjusted(0.5, 0.5, -0.5, -0.5); const QRectF borderRect = QRectF(rect).adjusted(0.5, 0.5, -0.5, -0.5);
if (creatorTheme()->widgetStyle() == Theme::StyleFlat) { if (creatorTheme()->flag(Theme::FlatToolBars)) {
const int margin = 3; const int margin = 3;
painter->setPen(creatorTheme()->color(Theme::FancyToolBarSeparatorColor)); painter->setPen(creatorTheme()->color(Theme::FancyToolBarSeparatorColor));
painter->drawLine(borderRect.topRight() + QPointF(0, margin), painter->drawLine(borderRect.topRight() + QPointF(0, margin),

View File

@@ -76,7 +76,7 @@ static const int buttonBorderWidth = 3;
static int numberAreaWidth() static int numberAreaWidth()
{ {
return creatorTheme()->widgetStyle() == Theme::StyleDefault ? 19 : 15; return creatorTheme()->flag(Theme::FlatToolBars) ? 15 : 19;
} }
//// ////
@@ -192,7 +192,7 @@ OutputPaneManager::OutputPaneManager(QWidget *parent) :
m_buttonsWidget->setLayout(new QHBoxLayout); m_buttonsWidget->setLayout(new QHBoxLayout);
m_buttonsWidget->layout()->setContentsMargins(5,0,0,0); m_buttonsWidget->layout()->setContentsMargins(5,0,0,0);
m_buttonsWidget->layout()->setSpacing( m_buttonsWidget->layout()->setSpacing(
creatorTheme()->widgetStyle() == Theme::StyleDefault ? 4 : 9); creatorTheme()->flag(Theme::FlatToolBars) ? 9 : 4);
} }
OutputPaneManager::~OutputPaneManager() OutputPaneManager::~OutputPaneManager()
@@ -687,16 +687,7 @@ void OutputPaneToggleButton::paintEvent(QPaintEvent*)
const bool hovered = !HostOsInfo::isMacHost() && (styleOption.state & QStyle::State_MouseOver); const bool hovered = !HostOsInfo::isMacHost() && (styleOption.state & QStyle::State_MouseOver);
const QImage *image = 0; const QImage *image = 0;
if (creatorTheme()->widgetStyle() == Theme::StyleDefault) { if (creatorTheme()->flag(Theme::FlatToolBars)) {
if (isDown())
image = &panelButtonPressed;
else if (isChecked())
image = hovered ? &panelButtonCheckedHover : &panelButtonChecked;
else
image = hovered ? &panelButtonHover : &panelButton;
if (image)
StyleHelper::drawCornerImage(*image, &p, rect(), numberAreaWidth(), buttonBorderWidth, buttonBorderWidth, buttonBorderWidth);
} else {
Theme::Color c = Theme::BackgroundColorDark; Theme::Color c = Theme::BackgroundColorDark;
if (hovered) if (hovered)
@@ -706,13 +697,22 @@ void OutputPaneToggleButton::paintEvent(QPaintEvent*)
if (c != Theme::BackgroundColorDark) if (c != Theme::BackgroundColorDark)
p.fillRect(rect(), creatorTheme()->color(c)); p.fillRect(rect(), creatorTheme()->color(c));
} else {
if (isDown())
image = &panelButtonPressed;
else if (isChecked())
image = hovered ? &panelButtonCheckedHover : &panelButtonChecked;
else
image = hovered ? &panelButtonHover : &panelButton;
if (image)
StyleHelper::drawCornerImage(*image, &p, rect(), numberAreaWidth(), buttonBorderWidth, buttonBorderWidth, buttonBorderWidth);
} }
if (m_flashTimer->state() == QTimeLine::Running) if (m_flashTimer->state() == QTimeLine::Running)
{ {
QColor c = creatorTheme()->color(Theme::OutputPaneButtonFlashColor); QColor c = creatorTheme()->color(Theme::OutputPaneButtonFlashColor);
c.setAlpha (m_flashTimer->currentFrame()); c.setAlpha (m_flashTimer->currentFrame());
QRect r = (creatorTheme()->widgetStyle() == Theme::StyleFlat) QRect r = creatorTheme()->flag(Theme::FlatToolBars)
? rect() : rect().adjusted(numberAreaWidth(), 1, -1, -1); ? rect() : rect().adjusted(numberAreaWidth(), 1, -1, -1);
p.fillRect(r, c); p.fillRect(r, c);
} }
@@ -781,7 +781,7 @@ QSize OutputPaneManageButton::sizeHint() const
void OutputPaneManageButton::paintEvent(QPaintEvent*) void OutputPaneManageButton::paintEvent(QPaintEvent*)
{ {
QPainter p(this); QPainter p(this);
if (creatorTheme()->widgetStyle() == Theme::StyleDefault) { if (!creatorTheme()->flag(Theme::FlatToolBars)) {
static const QImage button(StyleHelper::dpiSpecificImageFile(QStringLiteral(":/core/images/panel_manage_button.png"))); static const QImage button(StyleHelper::dpiSpecificImageFile(QStringLiteral(":/core/images/panel_manage_button.png")));
StyleHelper::drawCornerImage(button, &p, rect(), buttonBorderWidth, buttonBorderWidth, buttonBorderWidth, buttonBorderWidth); StyleHelper::drawCornerImage(button, &p, rect(), buttonBorderWidth, buttonBorderWidth, buttonBorderWidth, buttonBorderWidth);
} }

View File

@@ -295,7 +295,7 @@ void FutureProgress::mousePressEvent(QMouseEvent *event)
void FutureProgress::paintEvent(QPaintEvent *) void FutureProgress::paintEvent(QPaintEvent *)
{ {
QPainter p(this); QPainter p(this);
if (creatorTheme()->widgetStyle() == Theme::StyleFlat) { if (creatorTheme()->flag(Theme::FlatToolBars)) {
p.fillRect(rect(), StyleHelper::baseColor()); p.fillRect(rect(), StyleHelper::baseColor());
} else { } else {
QLinearGradient grad = StyleHelper::statusBarGradient(rect()); QLinearGradient grad = StyleHelper::statusBarGradient(rect());

View File

@@ -295,7 +295,7 @@ void ProgressBar::paintEvent(QPaintEvent *)
const QColor c = creatorTheme()->color(themeColor); const QColor c = creatorTheme()->color(themeColor);
//draw the progress bar //draw the progress bar
if (creatorTheme()->widgetStyle() == Theme::StyleFlat) { if (creatorTheme()->flag(Theme::FlatToolBars)) {
p.fillRect(rect.adjusted(2, 2, -2, -2), p.fillRect(rect.adjusted(2, 2, -2, -2),
creatorTheme()->color(Theme::ProgressBarBackgroundColor)); creatorTheme()->color(Theme::ProgressBarBackgroundColor));
p.fillRect(inner, c); p.fillRect(inner, c);
@@ -336,7 +336,7 @@ void ProgressBar::paintEvent(QPaintEvent *)
const bool hover = m_cancelRect.contains(mapFromGlobal(QCursor::pos())); const bool hover = m_cancelRect.contains(mapFromGlobal(QCursor::pos()));
const QRectF cancelVisualRect(m_cancelRect.adjusted(0, 1, -2, -2)); const QRectF cancelVisualRect(m_cancelRect.adjusted(0, 1, -2, -2));
int intensity = hover ? 90 : 70; int intensity = hover ? 90 : 70;
if (creatorTheme()->widgetStyle() != Theme::StyleFlat) { if (!creatorTheme()->flag(Theme::FlatToolBars)) {
QLinearGradient grad(cancelVisualRect.topLeft(), cancelVisualRect.bottomLeft()); QLinearGradient grad(cancelVisualRect.topLeft(), cancelVisualRect.bottomLeft());
QColor buttonColor(intensity, intensity, intensity, 255); QColor buttonColor(intensity, intensity, intensity, 255);
grad.setColorAt(0, buttonColor.lighter(130)); grad.setColorAt(0, buttonColor.lighter(130));

View File

@@ -708,7 +708,7 @@ ToggleButton::ToggleButton(QWidget *parent)
: QToolButton(parent) : QToolButton(parent)
{ {
setToolButtonStyle(Qt::ToolButtonIconOnly); setToolButtonStyle(Qt::ToolButtonIconOnly);
if (creatorTheme()->widgetStyle() == Theme::StyleFlat) { if (creatorTheme()->flag(Theme::FlatToolBars)) {
QPalette p = palette(); QPalette p = palette();
p.setBrush(QPalette::Base, creatorTheme()->color(Theme::ToggleButtonBackgroundColor)); p.setBrush(QPalette::Base, creatorTheme()->color(Theme::ToggleButtonBackgroundColor));
setPalette(p); setPalette(p);

View File

@@ -135,7 +135,7 @@ void TargetSelectorDelegate::paint(QPainter *painter,
const QColor color = (option.state & QStyle::State_HasFocus) ? const QColor color = (option.state & QStyle::State_HasFocus) ?
option.palette.highlight().color() : option.palette.highlight().color() :
option.palette.dark().color(); option.palette.dark().color();
if (creatorTheme()->widgetStyle() == Theme::StyleFlat) { if (creatorTheme()->flag(Theme::FlatToolBars)) {
painter->fillRect(option.rect, color); painter->fillRect(option.rect, color);
} else { } else {
painter->fillRect(option.rect, color.darker(140)); painter->fillRect(option.rect, color.darker(140));

View File

@@ -85,7 +85,7 @@ void RootWidget::paintEvent(QPaintEvent *e)
{ {
QWidget::paintEvent(e); QWidget::paintEvent(e);
if (creatorTheme()->widgetStyle() == Theme::StyleDefault) { if (!creatorTheme()->flag(Theme::FlatToolBars)) {
// draw separator line to the right of the settings panel // draw separator line to the right of the settings panel
QPainter painter(this); QPainter painter(this);
QColor light = StyleHelper::mergedColors( QColor light = StyleHelper::mergedColors(

View File

@@ -170,7 +170,7 @@ NavigatorTreeView::NavigatorTreeView(QWidget *parent)
void NavigatorTreeView::drawSelectionBackground(QPainter *painter, const QStyleOption &option) void NavigatorTreeView::drawSelectionBackground(QPainter *painter, const QStyleOption &option)
{ {
painter->save(); painter->save();
if (Utils::creatorTheme()->widgetStyle() == Utils::Theme::StyleFlat) { if (Utils::creatorTheme()->flag(Utils::Theme::FlatToolBars)) {
painter->setOpacity(0.5); painter->setOpacity(0.5);
painter->fillRect(option.rect, option.palette.color(QPalette::Highlight)); painter->fillRect(option.rect, option.palette.color(QPalette::Highlight));
} else { } else {