diff --git a/share/qtcreator/themes/design.creatortheme b/share/qtcreator/themes/design.creatortheme index 93355132175..95b5cf922ca 100644 --- a/share/qtcreator/themes/design.creatortheme +++ b/share/qtcreator/themes/design.creatortheme @@ -513,3 +513,4 @@ FlatMenuBar=true ToolBarIconShadow=true WindowColorAsBase=false DarkUserInterface=true +QDSTheme=true diff --git a/src/libs/utils/stylehelper.cpp b/src/libs/utils/stylehelper.cpp index 95c73a9d703..e8f46f40026 100644 --- a/src/libs/utils/stylehelper.cpp +++ b/src/libs/utils/stylehelper.cpp @@ -101,6 +101,14 @@ QColor StyleHelper::baseColor(bool lightColored) return (lightColored || windowColorAsBase) ? windowColor : m_baseColor; } +QColor StyleHelper::toolbarBaseColor(bool lightColored) +{ + if (creatorTheme()->flag(Theme::QDSTheme)) + return creatorTheme()->color(Utils::Theme::DStoolbarBackground); + else + return StyleHelper::baseColor(lightColored); +} + QColor StyleHelper::highlightColor(bool lightColored) { QColor result = baseColor(lightColored); @@ -626,6 +634,11 @@ QLinearGradient StyleHelper::statusBarGradient(const QRect &statusBarRect) return grad; } +bool StyleHelper::isQDSTheme() +{ + return creatorTheme()->flag(Theme::QDSTheme); +} + QIcon StyleHelper::getIconFromIconFont(const QString &fontName, const QList ¶meters) { QFontDatabase a; diff --git a/src/libs/utils/stylehelper.h b/src/libs/utils/stylehelper.h index 370e25d71eb..e9576a57588 100644 --- a/src/libs/utils/stylehelper.h +++ b/src/libs/utils/stylehelper.h @@ -33,6 +33,7 @@ public: // This is our color table, all colors derive from baseColor static QColor requestedBaseColor() { return m_requestedBaseColor; } static QColor baseColor(bool lightColored = false); + static QColor toolbarBaseColor(bool lightColored = false); static QColor panelTextColor(bool lightColored = false); static QColor highlightColor(bool lightColored = false); static QColor shadowColor(bool lightColored = false); @@ -72,6 +73,8 @@ public: static void tintImage(QImage &img, const QColor &tintColor); static QLinearGradient statusBarGradient(const QRect &statusBarRect); + static bool isQDSTheme(); + class IconFontHelper { public: diff --git a/src/libs/utils/theme/theme.h b/src/libs/utils/theme/theme.h index e60dc8417fd..52ef2b7ddcc 100644 --- a/src/libs/utils/theme/theme.h +++ b/src/libs/utils/theme/theme.h @@ -448,7 +448,8 @@ public: FlatMenuBar, ToolBarIconShadow, WindowColorAsBase, - DarkUserInterface + DarkUserInterface, + QDSTheme }; Q_ENUM(Color) diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index b2e7f349227..4cbda825399 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -522,9 +522,16 @@ int ManhattanStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, case PM_ButtonShiftHorizontal: case PM_MenuBarPanelWidth: case PM_ToolBarItemMargin: + if (StyleHelper::isQDSTheme()) { + retval = 0; + break; + } + [[fallthrough]]; case PM_ToolBarItemSpacing: if (panelWidget(widget)) retval = 0; + if (StyleHelper::isQDSTheme()) + retval = 4; break; case PM_DefaultFrameWidth: if (qobject_cast(widget) && panelWidget(widget)) @@ -1030,7 +1037,7 @@ void ManhattanStyle::drawPrimitiveForPanelWidget(PrimitiveElement element, break; case PE_IndicatorToolBarSeparator: - { + if (!StyleHelper::isQDSTheme()) { QRect separatorRect = rect; separatorRect.setLeft(rect.width() / 2); separatorRect.setWidth(1); @@ -1147,6 +1154,7 @@ void ManhattanStyle::drawControlForQmlEditor(ControlElement element, QPainter *painter, const QWidget *widget) const { + Q_UNUSED(element) if (const auto mbi = qstyleoption_cast(option)) { painter->save(); const int iconHeight = pixelMetric(QStyle::PM_SmallIconSize, option, widget); @@ -1518,7 +1526,7 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt bool drawLightColored = lightColored(widget); // draws the background of the 'Type hierarchy', 'Projects' headers if (creatorTheme()->flag(Theme::FlatToolBars)) - painter->fillRect(rect, StyleHelper::baseColor(drawLightColored)); + painter->fillRect(rect, StyleHelper::toolbarBaseColor(drawLightColored)); else if (horizontal) StyleHelper::horizontalGradient(painter, gradientSpan, rect, drawLightColored); else