diff options
| author | Vlad Zahorodnii <[email protected]> | 2025-11-21 22:39:04 +0200 |
|---|---|---|
| committer | Vlad Zahorodnii <[email protected]> | 2025-12-04 10:04:43 +0200 |
| commit | 987300bfa70a98cf3fd567fe3690d4600088b2e7 (patch) | |
| tree | 98a4fb276f9b1947c7f628712e70212fdf6f66d9 /src | |
| parent | 30782ffe6b754af425123d66d51734a9d8212367 (diff) | |
Remove Qt 2 compatibility code in QFont::fromString()
37c68503cbada547291ec4c4873dc054a8b82510 added the "count == 9" guard,
which effectively disabled the Qt 2 compatibility code.
Given that that compatibility code has been off for almost 5 years,
there is probably little point in fixing it now, so we might as well
remove it to simplify the QFont::fromString() function.
Change-Id: I677a033c74616c4cb5f24b750f47837d3ab75da8
Reviewed-by: Eskil Abrahamsen Blomfeldt <[email protected]>
Diffstat (limited to 'src')
| -rw-r--r-- | src/gui/text/qfont.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 17ed5fb7ed4..c144820fa24 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -2265,8 +2265,7 @@ bool QFont::fromString(const QString &descrip) const auto sr = QStringView(descrip).trimmed(); const auto l = sr.split(u','); const int count = l.size(); - if (!count || (count > 2 && count < 9) || count == 9 || - l.first().isEmpty()) { + if (!count || (count > 2 && count < 10) || l.first().isEmpty()) { qWarning("QFont::fromString: Invalid description '%s'", descrip.isEmpty() ? "(empty)" : descrip.toLatin1().data()); return false; @@ -2275,16 +2274,8 @@ bool QFont::fromString(const QString &descrip) setFamily(l[0].toString()); if (count > 1 && l[1].toDouble() > 0.0) setPointSizeF(l[1].toDouble()); - if (count == 9) { - setStyleHint((StyleHint) l[2].toInt()); - setWeight(QFont::Weight(l[3].toInt())); - setItalic(l[4].toInt()); - setUnderline(l[5].toInt()); - setStrikeOut(l[6].toInt()); - setFixedPitch(l[7].toInt()); - if (!d->request.fixedPitch) // assume 'false' fixedPitch equals default - d->request.ignorePitch = true; - } else if (count >= 10) { + + if (count >= 10) { if (l[2].toInt() > 0) setPixelSize(l[2].toInt()); setStyleHint((StyleHint) l[3].toInt()); |
