]> git.lyx.org Git - features.git/commitdiff
Fix Qt dep warn and remove XLFD font workaround
authorScott Kostyshak <skostysh@lyx.org>
Thu, 19 Mar 2020 16:20:16 +0000 (12:20 -0400)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:54 +0000 (15:48 +0200)
This commit fixes a few warnings from Qt 5.14 regarding
QFont::setRawName() and QFont::rawName() like the following one:

  error: ‘void QFont::setRawName(const QString&)’ is deprecated [-Werror=deprecated-declarations]

These methods were deprecated in Qt 5.3. [1]

This commit removes code from 2002 (539ce478) that worked around a
problem in Qt's handling of XLFD fonts that no longer seems relevant
since XLFD is no longer supported in Qt 5 [2]. Even if the problem
were relevant, setRawName() would not fix anything since it is now
an empty method. [3]

I tested that compilation with Qt 4.8.7 works without error.

[1] https://code.qt.io/cgit/qt/qtbase.git/tree/dist/changes-5.3.0/?h=v5.14.0
[2] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=3a8d7b0b9a4db91415b7bda2582a59a76b3754dc
[3] https://codereview.qt-project.org/c/qt/qtbase/+/100292/

src/frontends/qt/GuiFontLoader.cpp

index 9ea8e1837b8cdbcd2c0496d8567a4ef632b22601..c6c0ecbcd34ed3439bfb675bf3ec3efc47113ece 100644 (file)
@@ -126,17 +126,6 @@ GuiFontInfo & fontinfo(FontInfo const & f)
 }
 
 
-QString rawName(QString const & family)
-{
-       for (size_t i = 0; i < nr_symbol_fonts; ++i)
-               if (family == symbol_fonts[i].family)
-                       return symbol_fonts[i].xlfd;
-
-       LYXERR(Debug::FONT, "BUG: family not found !");
-       return QString();
-}
-
-
 QString symbolFamily(FontFamily family)
 {
        for (size_t i = 0; i < nr_symbol_fonts; ++i) {
@@ -215,11 +204,8 @@ QFont symbolFont(QString const & family, bool * ok)
                return font;
        }
 
-       // A simple setFamily() fails on Qt 2
-
-       QString const raw = rawName(family);
-       LYXERR(Debug::FONT, "Trying " << raw << " ... ");
-       font.setRawName(raw);
+       LYXERR(Debug::FONT, "Trying " << family << " ... ");
+       font.setFamily(family);
 
        if (isChosenFont(font, family, QString())) {
                LYXERR(Debug::FONT, "raw version!");
@@ -359,8 +345,6 @@ QFont makeQFont(FontInfo const & f)
        else
                LYXERR(Debug::FONT, "This font is NOT an exact match");
 
-       LYXERR(Debug::FONT, "XFLD: " << font.rawName());
-
        font.setPointSizeF(f.realSize() * lyxrc.currentZoom / 100.0);
 
        LYXERR(Debug::FONT, "The font has size: " << font.pointSizeF());