From e65e8e25d75ea20d88bf956193b33a8dc9664ef2 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 5 Jun 2025 16:50:09 +0200 Subject: [PATCH] Utils: Migrate to new spacing tokens The spacing tokens in the Figma designs were reorganized. This change adopts the new tokens in Qt Creator. Only constants names do change, all values remain the same as they were. Change-Id: Icedf82bfd55a145ccf3d31d955ddda636ca2f564 Reviewed-by: hjk --- src/libs/utils/aspects.cpp | 2 +- src/libs/utils/markdownbrowser.cpp | 10 +- src/libs/utils/qtcwidgets.cpp | 103 +++++++++-------- src/libs/utils/stylehelper.h | 64 +++++++---- .../progressmanager/progressmanager.cpp | 18 +-- src/plugins/coreplugin/versiondialog.cpp | 2 +- src/plugins/coreplugin/welcomepagehelper.cpp | 108 +++++++++--------- .../extensionmanagersettings.cpp | 2 +- .../extensionmanagerwidget.cpp | 33 +++--- .../extensionmanager/extensionsbrowser.cpp | 98 ++++++++-------- src/plugins/learning/qtacademywelcomepage.cpp | 6 +- src/plugins/lua/bindings/fetch.cpp | 2 +- src/plugins/lua/bindings/install.cpp | 2 +- .../projectexplorer/projectwelcomepage.cpp | 46 ++++---- .../qtsupport/gettingstartedwelcomepage.cpp | 12 +- src/plugins/welcome/welcomeplugin.cpp | 6 +- 16 files changed, 263 insertions(+), 251 deletions(-) diff --git a/src/libs/utils/aspects.cpp b/src/libs/utils/aspects.cpp index 89f8acb8d4a..1cc844d2732 100644 --- a/src/libs/utils/aspects.cpp +++ b/src/libs/utils/aspects.cpp @@ -2129,7 +2129,7 @@ void BoolAspect::addToLayoutHelper(Layouting::Layout &parent, QAbstractButton *b ttLabel->setFont(StyleHelper::uiFont(StyleHelper::UiElementLabelSmall)); auto lt = new QVBoxLayout; lt->setContentsMargins({}); - lt->setSpacing(StyleHelper::SpacingTokens::VGapXxs); + lt->setSpacing(StyleHelper::SpacingTokens::GapVXs); lt->addWidget(button); lt->addWidget(ttLabel); parent.addItem(lt); diff --git a/src/libs/utils/markdownbrowser.cpp b/src/libs/utils/markdownbrowser.cpp index 2c90f426aa8..7d77981c3e7 100644 --- a/src/libs/utils/markdownbrowser.cpp +++ b/src/libs/utils/markdownbrowser.cpp @@ -647,9 +647,9 @@ void MarkdownBrowser::highlightCodeBlock(const QString &language, QTextBlock &bl QTextFrameFormat frameFormat; frameFormat.setBorderStyle(QTextFrameFormat::BorderStyle_Solid); frameFormat.setBackground(creatorColor(Theme::Token_Background_Muted)); - frameFormat.setPadding(SpacingTokens::ExPaddingGapM); - frameFormat.setLeftMargin(SpacingTokens::VGapM); - frameFormat.setRightMargin(SpacingTokens::VGapM); + frameFormat.setPadding(SpacingTokens::PaddingVS); + frameFormat.setLeftMargin(SpacingTokens::PaddingVXs); + frameFormat.setRightMargin(SpacingTokens::PaddingVXs); QTextFrame *frame = cursor.insertFrame(frameFormat); QTextCursor frameCursor(frame); @@ -837,8 +837,8 @@ void MarkdownBrowser::postProcessDocument(bool firstTime) }; if (blockFormat.hasProperty(QTextFormat::HeadingLevel)) { - blockFormat.setTopMargin(SpacingTokens::ExVPaddingGapXl * fontScale); - blockFormat.setBottomMargin(SpacingTokens::VGapL * fontScale); + blockFormat.setTopMargin(SpacingTokens::PaddingVXxl * fontScale); + blockFormat.setBottomMargin(SpacingTokens::GapVM * fontScale); } else { blockFormat .setLineHeight(lineHeight(contentTF) * fontScale, QTextBlockFormat::FixedHeight); diff --git a/src/libs/utils/qtcwidgets.cpp b/src/libs/utils/qtcwidgets.cpp index b759bdebdb4..a07f628acbf 100644 --- a/src/libs/utils/qtcwidgets.cpp +++ b/src/libs/utils/qtcwidgets.cpp @@ -138,31 +138,31 @@ QSize QtcButton::minimumSizeHint() const void QtcButton::paintEvent(QPaintEvent *event) { // Without pixmap - // +----------------+----------------+----------------+ - // | |(VPadding[S|XS])| | - // | +----------------+----------------+ - // |(HPadding[S|XS])|