From 8fd8034d2a7f69d8be1b04b1eee266307aa0da82 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Tue, 20 Feb 2024 13:31:53 +0100 Subject: [PATCH] Qt5 incompatibility fixed --- src/controls/QskSkin.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/controls/QskSkin.cpp b/src/controls/QskSkin.cpp index 416f7a0a..51de03f0 100644 --- a/src/controls/QskSkin.cpp +++ b/src/controls/QskSkin.cpp @@ -344,8 +344,15 @@ void QskSkin::completeFontTable() continue; } - int weight = normalFont.weight() + ( j - 2 ) * 100; - weight = qBound( 0, weight, 900 ); +#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) + const auto step = 10; // weight: [0-99] +#else + const auto step = 100; // weight: [1-1000] +#endif + + int weight = normalFont.weight() + ( j - 2 ) * step; + weight = qBound( static_cast( QFont::Thin ), + weight, static_cast( QFont::Black ) ); auto font = normalFont; font.setWeight( static_cast< QFont::Weight >( weight ) );