Utils: Align enum StyleHelper::UiElement with upcoming design system #2

This change "PanelTitle" to "Caption". It is supposed to not change the
visual appearance.

Change-Id: I3342e6c80d8ce11b7ab1ac40b4395c265e1e07ec
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Alessandro Portale
2023-11-17 11:02:38 +01:00
parent 7f60ce0666
commit b3acdae338
8 changed files with 14 additions and 15 deletions

View File

@@ -952,12 +952,11 @@ QFont StyleHelper::UiFont(UiElement element)
font.setPointSizeF(font.pointSizeF() * 1.2); font.setPointSizeF(font.pointSizeF() * 1.2);
font.setBold(true); font.setBold(true);
break; break;
case UiElementPanelTitle: { case UiElementCaptionStrong:
font.setPointSizeF(panelTitleSize); font.setPointSizeF(panelTitleSize);
font.setBold(true); font.setBold(true);
break; break;
} case UiElementCaption:
case UiElementPanelSubtitle:
font.setPointSizeF(panelTitleSize); font.setPointSizeF(panelTitleSize);
break; break;
} }

View File

@@ -52,8 +52,8 @@ enum UiElement {
UiElementH2, UiElementH2,
UiElementH3, UiElementH3,
UiElementH4, UiElementH4,
UiElementPanelTitle, UiElementCaptionStrong,
UiElementPanelSubtitle, UiElementCaption,
}; };
// Height of the project explorer navigation bar // Height of the project explorer navigation bar

View File

@@ -181,9 +181,9 @@ void FancyToolButton::paintEvent(QPaintEvent *event)
const bool isTitledAction = defaultAction() && defaultAction()->property("titledAction").toBool(); const bool isTitledAction = defaultAction() && defaultAction()->property("titledAction").toBool();
// draw popup texts // draw popup texts
if (isTitledAction && !m_iconsOnly) { if (isTitledAction && !m_iconsOnly) {
const QFont normalFont = StyleHelper::UiFont(StyleHelper::UiElementPanelSubtitle); const QFont normalFont = StyleHelper::UiFont(StyleHelper::UiElementCaption);
QRect centerRect = rect(); QRect centerRect = rect();
const QFont boldFont = StyleHelper::UiFont(StyleHelper::UiElementPanelTitle); const QFont boldFont = StyleHelper::UiFont(StyleHelper::UiElementCaptionStrong);
const QFontMetrics fm(normalFont); const QFontMetrics fm(normalFont);
const QFontMetrics boldFm(boldFont); const QFontMetrics boldFm(boldFont);
const int lineHeight = boldFm.height(); const int lineHeight = boldFm.height();
@@ -284,7 +284,7 @@ QSize FancyToolButton::sizeHint() const
QSizeF buttonSize = iconSize().expandedTo(QSize(64, 38)); QSizeF buttonSize = iconSize().expandedTo(QSize(64, 38));
if (defaultAction() && defaultAction()->property("titledAction").toBool()) { if (defaultAction() && defaultAction()->property("titledAction").toBool()) {
const QFont boldFont = StyleHelper::UiFont(StyleHelper::UiElementPanelTitle); const QFont boldFont = StyleHelper::UiFont(StyleHelper::UiElementCaptionStrong);
const QFontMetrics fm(boldFont); const QFontMetrics fm(boldFont);
const qreal lineHeight = fm.height(); const qreal lineHeight = fm.height();
const int extraHeight = 10 // Spacing between top and projectName const int extraHeight = 10 // Spacing between top and projectName

View File

@@ -68,7 +68,7 @@ QSize FancyTabBar::tabSizeHint(bool minimum) const
Core::Constants::MODEBAR_ICONSONLY_BUTTON_SIZE / (minimum ? 3 : 1)}; Core::Constants::MODEBAR_ICONSONLY_BUTTON_SIZE / (minimum ? 3 : 1)};
} }
const QFont boldFont = StyleHelper::UiFont(StyleHelper::UiElementPanelTitle); const QFont boldFont = StyleHelper::UiFont(StyleHelper::UiElementCaptionStrong);
const QFontMetrics fm(boldFont); const QFontMetrics fm(boldFont);
const int spacing = 8; const int spacing = 8;
const int width = 60 + spacing + 2; const int width = 60 + spacing + 2;
@@ -283,7 +283,7 @@ static void paintIconAndText(QPainter *painter, const QRect &rect,
const QIcon &icon, const QString &text, const QIcon &icon, const QString &text,
bool enabled, bool selected) bool enabled, bool selected)
{ {
const QFont boldFont = StyleHelper::UiFont(StyleHelper::UiElementPanelTitle); const QFont boldFont = StyleHelper::UiFont(StyleHelper::UiElementCaptionStrong);
painter->setFont(boldFont); painter->setFont(boldFont);
const bool drawIcon = rect.height() > 36; const bool drawIcon = rect.height() > 36;

View File

@@ -166,7 +166,7 @@ QSize ProgressBar::sizeHint() const
int width = 50; int width = 50;
int height = PROGRESSBAR_HEIGHT + 5; int height = PROGRESSBAR_HEIGHT + 5;
if (m_titleVisible) { if (m_titleVisible) {
const QFont font = StyleHelper::UiFont(StyleHelper::UiElementPanelTitle); const QFont font = StyleHelper::UiFont(StyleHelper::UiElementCaptionStrong);
const QFontMetrics fm(font); const QFontMetrics fm(font);
width = qMax(width, fm.horizontalAdvance(m_title) + 16); width = qMax(width, fm.horizontalAdvance(m_title) + 16);
height += fm.height() + 5; height += fm.height() + 5;
@@ -213,7 +213,7 @@ void ProgressBar::paintEvent(QPaintEvent *)
percent = 1; percent = 1;
QPainter p(this); QPainter p(this);
const QFont fnt = StyleHelper::UiFont(StyleHelper::UiElementPanelTitle); const QFont fnt = StyleHelper::UiFont(StyleHelper::UiElementCaptionStrong);
const QFontMetrics fm(fnt); const QFontMetrics fm(fnt);
const int titleHeight = m_titleVisible ? fm.height() + 5 : 4; const int titleHeight = m_titleVisible ? fm.height() + 5 : 4;

View File

@@ -661,7 +661,7 @@ void ProgressManagerPrivate::updateStatusDetailsWidget()
} else if (progress->isSubtitleVisibleInStatusBar() && !progress->subtitle().isEmpty()) { } else if (progress->isSubtitleVisibleInStatusBar() && !progress->subtitle().isEmpty()) {
if (!m_statusDetailsLabel) { if (!m_statusDetailsLabel) {
m_statusDetailsLabel = new QLabel(m_summaryProgressWidget); m_statusDetailsLabel = new QLabel(m_summaryProgressWidget);
const QFont font = StyleHelper::UiFont(StyleHelper::UiElementPanelTitle); const QFont font = StyleHelper::UiFont(StyleHelper::UiElementCaptionStrong);
m_statusDetailsLabel->setFont(font); m_statusDetailsLabel->setFont(font);
} }
m_statusDetailsLabel->setText(progress->subtitle()); m_statusDetailsLabel->setText(progress->subtitle());

View File

@@ -49,7 +49,7 @@ BuildProgress::BuildProgress(TaskWindow *taskWindow, Qt::Orientation orientation
warningLayout->addWidget(m_warningIcon); warningLayout->addWidget(m_warningIcon);
warningLayout->addWidget(m_warningLabel); warningLayout->addWidget(m_warningLabel);
const QFont f = Utils::StyleHelper::UiFont(Utils::StyleHelper::UiElementPanelTitle); const QFont f = Utils::StyleHelper::UiFont(Utils::StyleHelper::UiElementCaptionStrong);
m_errorLabel->setFont(f); m_errorLabel->setFont(f);
m_warningLabel->setFont(f); m_warningLabel->setFont(f);
m_errorLabel->setPalette(Utils::StyleHelper::sidebarFontPalette(m_errorLabel->palette())); m_errorLabel->setPalette(Utils::StyleHelper::sidebarFontPalette(m_errorLabel->palette()));

View File

@@ -20,7 +20,7 @@ DragShapeButton::DragShapeButton(QWidget *parent)
setMinimumSize(75, 75); setMinimumSize(75, 75);
setMaximumSize(75, 75); setMaximumSize(75, 75);
setIconSize(QSize(45, 45)); setIconSize(QSize(45, 45));
setFont(Utils::StyleHelper::UiFont(Utils::StyleHelper::UiElementPanelSubtitle)); setFont(Utils::StyleHelper::UiFont(Utils::StyleHelper::UiElementCaption));
} }
void DragShapeButton::setShapeInfo(int groupIndex, int shapeIndex) void DragShapeButton::setShapeInfo(int groupIndex, int shapeIndex)