From 49dda7ec04abd110e9d756ec00ac4027c3ad2c99 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Fri, 9 Feb 2024 09:11:41 +0100 Subject: [PATCH] QskSkinnable::effectiveFont accepts QFont ( beside font roles ). This allows to assign individual fonts in application code without having to define font roles --- src/controls/QskSkinnable.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/controls/QskSkinnable.cpp b/src/controls/QskSkinnable.cpp index 0ca14bdc..9d6ed3a9 100644 --- a/src/controls/QskSkinnable.cpp +++ b/src/controls/QskSkinnable.cpp @@ -722,7 +722,18 @@ int QskSkinnable::fontRoleHint( QFont QskSkinnable::effectiveFont( const QskAspect aspect ) const { - return effectiveSkin()->font( fontRoleHint( aspect ) ); + const auto hint = effectiveSkinHint( aspect | QskAspect::FontRole ); + if ( hint.canConvert< QFont >() ) + { + /* + The provided skins/controls use font roles only - however + application code might want to assign fonts without defining + font roles. + */ + return hint.value< QFont >(); + } + + return effectiveSkin()->font( hint.toInt() ); // font role } qreal QskSkinnable::effectiveFontHeight( const QskAspect aspect ) const