summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2019-10-29 09:44:50 +0100
committerAndy Shaw <andy.shaw@qt.io>2019-11-05 09:46:29 +0100
commitb1004c7d0a5d7abbacd687fd41a5b2683e62b27d (patch)
treef2ad983ceccb6bbcfdc24c1581bed8691a8c7a0b /src/gui/text
parent99e43db7cea1c838993c151d2d40fc2874a94256 (diff)
If only family is set, prefer that in the families list after resolving
If a font with only a family set is resolved with one that has been setup with setFamilies() then the family needs to be prepended to the families list after resolving. This is so that the font still prefers the one set as just a family with no famillies set. This also amends the QFontDialog test to account for this too. [ChangeLog][QtGui][Text] Resolving a font that just has a family set with families set will prepend the family to the families so that it is still the first preference for the font. Task-number: QTBUG-46322 Change-Id: Icc4005732f95b2b4c684e592b06b31e133270e44 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qfont.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 84c5be60b1..f5dbec3a3e 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -271,8 +271,13 @@ void QFontPrivate::resolve(uint mask, const QFontPrivate *other)
if (! (mask & QFont::FamilyResolved))
request.family = other->request.family;
- if (!(mask & QFont::FamiliesResolved))
+ if (!(mask & QFont::FamiliesResolved)) {
request.families = other->request.families;
+ // Prepend the family explicitly set so it will be given
+ // preference in this case
+ if (mask & QFont::FamilyResolved)
+ request.families.prepend(request.family);
+ }
if (! (mask & QFont::StyleNameResolved))
request.styleName = other->request.styleName;