Utils: Add toolbarStyle to StyleHelper

Task-number: QTCREATORBUG-29054
Change-Id: I01572eb7bdd267ea6aadb9530afc52b3c7834382
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Alessandro Portale
2023-04-14 15:43:31 +02:00
parent 2e9494bd71
commit 495f5f006f
2 changed files with 26 additions and 1 deletions

View File

@@ -58,6 +58,21 @@ QColor StyleHelper::alphaBlendedColors(const QColor &colorA, const QColor &color
); );
} }
int StyleHelper::navigationWidgetHeight()
{
return m_toolbarStyle == ToolbarStyleCompact ? 24 : 30;
}
void StyleHelper::setToolbarStyle(ToolbarStyle style)
{
m_toolbarStyle = style;
}
StyleHelper::ToolbarStyle StyleHelper::toolbarStyle()
{
return m_toolbarStyle;
}
qreal StyleHelper::sidebarFontSize() qreal StyleHelper::sidebarFontSize()
{ {
return HostOsInfo::isMacHost() ? 10 : 7.5; return HostOsInfo::isMacHost() ? 10 : 7.5;
@@ -89,6 +104,7 @@ QColor StyleHelper::panelTextColor(bool lightColored)
return Qt::black; return Qt::black;
} }
StyleHelper::ToolbarStyle StyleHelper::m_toolbarStyle = StyleHelper::defaultToolbarStyle;
// Invalid by default, setBaseColor needs to be called at least once // Invalid by default, setBaseColor needs to be called at least once
QColor StyleHelper::m_baseColor; QColor StyleHelper::m_baseColor;
QColor StyleHelper::m_requestedBaseColor; QColor StyleHelper::m_requestedBaseColor;

View File

@@ -25,8 +25,16 @@ public:
static const unsigned int DEFAULT_BASE_COLOR = 0x666666; static const unsigned int DEFAULT_BASE_COLOR = 0x666666;
static const int progressFadeAnimationDuration = 600; static const int progressFadeAnimationDuration = 600;
enum ToolbarStyle {
ToolbarStyleCompact,
ToolbarStyleRelaxed,
};
// Height of the project explorer navigation bar // Height of the project explorer navigation bar
static int navigationWidgetHeight() { return 24; } static int navigationWidgetHeight();
static void setToolbarStyle(ToolbarStyle style);
static ToolbarStyle toolbarStyle();
static constexpr ToolbarStyle defaultToolbarStyle = ToolbarStyleCompact;
static qreal sidebarFontSize(); static qreal sidebarFontSize();
static QPalette sidebarFontPalette(const QPalette &original); static QPalette sidebarFontPalette(const QPalette &original);
@@ -122,6 +130,7 @@ public:
static QColor ensureReadableOn(const QColor &background, const QColor &desiredForeground); static QColor ensureReadableOn(const QColor &background, const QColor &desiredForeground);
private: private:
static ToolbarStyle m_toolbarStyle;
static QColor m_baseColor; static QColor m_baseColor;
static QColor m_requestedBaseColor; static QColor m_requestedBaseColor;
}; };