forked from qt-creator/qt-creator
Utils: Introduce H5, H6 and "H6 Capital" Ui fonts
As defined by the new Qt Creator design system. Change-Id: Ib67b35ea552cf88c4b89481b72e690e04a57bbb7 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -967,6 +967,17 @@ QFont StyleHelper::uiFont(UiElement element)
|
||||
font.setPointSizeF(font.pointSizeF() * 1.2);
|
||||
font.setBold(true);
|
||||
break;
|
||||
case UiElementH5:
|
||||
font.setPointSizeF(font.pointSizeF() * 1.2);
|
||||
font.setWeight(QFont::DemiBold);
|
||||
break;
|
||||
case UiElementH6:
|
||||
font.setWeight(QFont::DemiBold);
|
||||
break;
|
||||
case UiElementH6Capital:
|
||||
font.setWeight(QFont::DemiBold);
|
||||
font.setCapitalization(QFont::AllUppercase);
|
||||
break;
|
||||
case UiElementCaptionStrong:
|
||||
font.setPointSizeF(panelTitleSize);
|
||||
font.setWeight(QFont::DemiBold);
|
||||
@@ -989,10 +1000,15 @@ QString StyleHelper::fontToCssProperties(const QFont &font)
|
||||
const QString fontShorthand = fontStyle + " " + QString::number(font.weight()) + " "
|
||||
+ fontSize + " " + font.family();
|
||||
const QString textDecoration = QLatin1String(font.underline() ? "underline" : "none");
|
||||
const QString textTransform = QLatin1String(font.capitalization() == QFont::AllUppercase
|
||||
? "uppercase"
|
||||
: font.capitalization() == QFont::AllLowercase
|
||||
? "lowercase" : "none");
|
||||
const QString propertyTemplate = "%1: %2";
|
||||
const QStringList cssProperties = {
|
||||
propertyTemplate.arg("font").arg(fontShorthand),
|
||||
propertyTemplate.arg("text-decoration").arg(textDecoration),
|
||||
propertyTemplate.arg("text-transform").arg(textTransform),
|
||||
propertyTemplate.arg("word-spacing").arg(font.wordSpacing()),
|
||||
};
|
||||
const QString fontCssStyle = cssProperties.join("; ");
|
||||
|
||||
@@ -52,6 +52,9 @@ enum UiElement {
|
||||
UiElementH2,
|
||||
UiElementH3,
|
||||
UiElementH4,
|
||||
UiElementH5,
|
||||
UiElementH6,
|
||||
UiElementH6Capital,
|
||||
UiElementCaptionStrong,
|
||||
UiElementCaption,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user