summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/text/qfont_p.h4
-rw-r--r--tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h
index 3f8241a80e..25b5ef0b0e 100644
--- a/src/gui/text/qfont_p.h
+++ b/src/gui/text/qfont_p.h
@@ -102,7 +102,7 @@ struct QFontDef
&& styleStrategy == other.styleStrategy
&& ignorePitch == other.ignorePitch && fixedPitch == other.fixedPitch
&& family == other.family
- && (styleName.isEmpty() || other.styleName.isEmpty() || styleName == other.styleName)
+ && styleName == other.styleName
&& hintingPreference == other.hintingPreference
;
}
@@ -115,7 +115,7 @@ struct QFontDef
if (styleHint != other.styleHint) return styleHint < other.styleHint;
if (styleStrategy != other.styleStrategy) return styleStrategy < other.styleStrategy;
if (family != other.family) return family < other.family;
- if (!styleName.isEmpty() && !other.styleName.isEmpty() && styleName != other.styleName)
+ if (styleName != other.styleName)
return styleName < other.styleName;
if (hintingPreference != other.hintingPreference) return hintingPreference < other.hintingPreference;
diff --git a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp
index bac72f0365..796b4b9fdb 100644
--- a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp
+++ b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp
@@ -225,6 +225,8 @@ void tst_QFontDialog::qtbug_41513_stylesheetStyle()
QFontDialog::DontUseNativeDialog);
QVERIFY(accepted);
+ // The fontdialog sets the styleName, when the fontdatabase knows the style name.
+ resultFont.setStyleName(testFont.styleName());
QCOMPARE(resultFont, testFont);
// reset stylesheet