D27380: [GTK Config] Write Font without style name

David Edmundson noreply at phabricator.kde.org
Thu Feb 13 23:08:42 GMT 2020


davidedmundson added a comment.


  Take this code:
  
    static QString styleStringHelper(int weight, QFont::Style style)
    {
        QString result;
        if (weight > QFont::Normal) {
            if (weight >= QFont::Black)
                result = QCoreApplication::translate("QFontDatabase", "Black");
            else if (weight >= QFont::ExtraBold)
                result = QCoreApplication::translate("QFontDatabase", "Extra Bold");
            else if (weight >= QFont::Bold)
                result = QCoreApplication::translate("QFontDatabase", "Bold");
            else if (weight >= QFont::DemiBold)
                result = QCoreApplication::translate("QFontDatabase", "Demi Bold");
            else if (weight >= QFont::Medium)
                result = QCoreApplication::translate("QFontDatabase", "Medium", "The Medium font weight");
        } else {
            if (weight <= QFont::Thin)
                result = QCoreApplication::translate("QFontDatabase", "Thin");
            else if (weight <= QFont::ExtraLight)
                result = QCoreApplication::translate("QFontDatabase", "Extra Light");
            else if (weight <= QFont::Light)
                result = QCoreApplication::translate("QFontDatabase", "Light");
        }
    
        if (style == QFont::StyleItalic)
            result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Italic");
        else if (style == QFont::StyleOblique)
            result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Oblique");
    
        if (result.isEmpty())
            result = QCoreApplication::translate("QFontDatabase", "Normal", "The Normal or Regular font weight");
    
        return result.simplified();
    }
  
  Drop the QCoreApplication::translate("QFontDatabase", "  stuff, and it should work fine.

REPOSITORY
  R99 KDE Gtk Configuration Tool

REVISION DETAIL
  https://phabricator.kde.org/D27380

To: gikari, #plasma, ervin, bport, meven
Cc: davidedmundson, cfeck, ngraham, IlyaBizyaev, plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, ragreen, ZrenBot, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20200213/238f1f4b/attachment.html>


More information about the Plasma-devel mailing list