From 0650fe14e524f9643dce0105b79983e9b5baa4c8 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 5 Jun 2024 13:50:19 +0200 Subject: [PATCH] Utils: Update Figma text tokens This adds UiElementLabelMedium and UiElementLabelSmall. Change-Id: I592f2bdf7a4d0a98e38ea69c33cf1b27040f7eea Reviewed-by: hjk --- src/libs/utils/stylehelper.cpp | 2 ++ src/libs/utils/stylehelper.h | 4 ++++ src/plugins/coreplugin/icore.cpp | 2 ++ tests/manual/widgets/uifonts/tst_manual_widgets_uifonts.cpp | 2 ++ 4 files changed, 10 insertions(+) diff --git a/src/libs/utils/stylehelper.cpp b/src/libs/utils/stylehelper.cpp index 617dac09a8e..4472c43b558 100644 --- a/src/libs/utils/stylehelper.cpp +++ b/src/libs/utils/stylehelper.cpp @@ -950,6 +950,8 @@ static const UiFontMetrics& uiFontMetrics(StyleHelper::UiElement element) {StyleHelper::UiElementBody2, {12, 20, QFont::Light}}, {StyleHelper::UiElementButtonMedium, {12, 16, QFont::Bold}}, {StyleHelper::UiElementButtonSmall, {10, 12, QFont::Bold}}, + {StyleHelper::UiElementLabelMedium, {12, 16, QFont::DemiBold}}, + {StyleHelper::UiElementLabelSmall, {10, 12, QFont::DemiBold}}, {StyleHelper::UiElementCaptionStrong, {10, 12, QFont::DemiBold}}, {StyleHelper::UiElementCaption, {10, 12, QFont::Normal}}, {StyleHelper::UiElementIconStandard, {12, 16, QFont::Medium}}, diff --git a/src/libs/utils/stylehelper.h b/src/libs/utils/stylehelper.h index 7d434925e66..ecc2eea2b96 100644 --- a/src/libs/utils/stylehelper.h +++ b/src/libs/utils/stylehelper.h @@ -79,6 +79,8 @@ enum ToolbarStyle { }; constexpr ToolbarStyle defaultToolbarStyle = ToolbarStyleCompact; +// Keep in sync with: +// SyleHelper::uiFontMetrics, ICore::uiConfigInformation, tst_manual_widgets_uifonts::main enum UiElement { UiElementH1, UiElementH2, @@ -91,6 +93,8 @@ enum UiElement { UiElementBody2, UiElementButtonMedium, UiElementButtonSmall, + UiElementLabelMedium, + UiElementLabelSmall, UiElementCaptionStrong, UiElementCaption, UiElementIconStandard, diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp index da47d44b6e0..a4098963a60 100644 --- a/src/plugins/coreplugin/icore.cpp +++ b/src/plugins/coreplugin/icore.cpp @@ -1068,6 +1068,8 @@ QString uiConfigInformation() QTC_ADD_UIELEMENT_FONT(Body2); QTC_ADD_UIELEMENT_FONT(ButtonMedium); QTC_ADD_UIELEMENT_FONT(ButtonSmall); + QTC_ADD_UIELEMENT_FONT(LabelMedium); + QTC_ADD_UIELEMENT_FONT(LabelSmall); QTC_ADD_UIELEMENT_FONT(CaptionStrong); QTC_ADD_UIELEMENT_FONT(Caption); QTC_ADD_UIELEMENT_FONT(IconStandard); diff --git a/tests/manual/widgets/uifonts/tst_manual_widgets_uifonts.cpp b/tests/manual/widgets/uifonts/tst_manual_widgets_uifonts.cpp index 247bba67728..ecbf4b274b8 100644 --- a/tests/manual/widgets/uifonts/tst_manual_widgets_uifonts.cpp +++ b/tests/manual/widgets/uifonts/tst_manual_widgets_uifonts.cpp @@ -29,6 +29,8 @@ int main(int argc, char *argv[]) { StyleHelper::UiElementBody2, "Body-02" }, { StyleHelper::UiElementButtonMedium, "Button Medium" }, { StyleHelper::UiElementButtonSmall, "Button Small" }, + { StyleHelper::UiElementLabelMedium, "Label Medium" }, + { StyleHelper::UiElementLabelSmall, "Label Small" }, { StyleHelper::UiElementCaptionStrong, "Caption strong" }, { StyleHelper::UiElementCaption, "Caption" }, { StyleHelper::UiElementIconStandard, "Icon Standard" },