From f6940d5102253ea992bdb457843e08dbe3f947dd Mon Sep 17 00:00:00 2001 From: Doris Verria Date: Thu, 17 Sep 2026 23:11:24 +0200 Subject: QQStyleKitTheme: Keep the font resolve mask when merging font scopes QFont::resolve() returns only the left-hand operand's resolve mask, unlike QPalette::resolve() which ORs both, so each step of the fallback chain in updateThemeFonts() collapsed the accumulated mask down to the nearest layer's. Setting fonts.system.bold in a theme therefore produced a font still holding the style's family and pointSize as values, but with a mask claiming only Weight. To fix, set the resolve mask to the union explicitly. Pick-to: 6.12 Change-Id: Ib802a8ce3d8a5760bc9639631080a25d5e2658df Reviewed-by: Richard Moe Gustavsen --- src/labs/stylekit/qqstylekittheme.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/labs/stylekit/qqstylekittheme.cpp b/src/labs/stylekit/qqstylekittheme.cpp index a0dfdb7d4f..6edb8de25c 100644 --- a/src/labs/stylekit/qqstylekittheme.cpp +++ b/src/labs/stylekit/qqstylekittheme.cpp @@ -197,6 +197,15 @@ void QQStyleKitTheme::updateThemeFonts() for (auto *fb = fonts; fb; fb = fb->fallbackFont()) fbChain.append(fb); + // QFont::resolve() keeps only the left-hand operand's resolve mask. + // Restore the mask explicitly, or every attribute contributed by an + // earlier layer of the chain is dropped again by font resolution. + auto merge = [](const QFont &a, const QFont &b) { + QFont merged = a.resolve(b); + merged.setResolveMask(b.resolveMask() | a.resolveMask()); + return merged; + }; + auto resolveFromFontChain = [&](QQuickTheme::Scope scope) -> QFont { QFont result; @@ -206,10 +215,10 @@ void QQStyleKitTheme::updateThemeFonts() const QQStyleKitFont *fb = fbChain[i]; // Apply system font first as a base, and override with scope-specific font if (scope != QQuickTheme::System && fb->isSet(QQuickTheme::System)) { - result = fb->fontForScope(QQuickTheme::System).resolve(result); + result = merge(fb->fontForScope(QQuickTheme::System), result); } if (fb->isSet(scope)) { - result = fb->fontForScope(scope).resolve(result); + result = merge(fb->fontForScope(scope), result); } } -- cgit v1.2.3