Font definitions with different style names are not equal
Since we added font matching by style name, the style name is not just a derived property and should not be ignored in comparisons. The QFontDef::exactMatch comparison is left unchanged, since it tests if a loaded font matches a requested one. Task-number: QTBUG-30851 Change-Id: I4187c5b993815001f35bcf24dc449059bfdcba6f Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>bb10
parent
525a660ea3
commit
f04ed82ca2
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue