diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2016-03-04 12:13:09 +0100 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2020-01-21 07:27:49 +0100 |
commit | a43a0cf5e626c08868951096b8549d804192f79e (patch) | |
tree | 2002245ee344c9dd077e99152a7f3016427b562f /src/quick/util/qquickvaluetypes.cpp | |
parent | 15ea475b40f6ad28d46e5cbd65a1ccc8556a53df (diff) |
Make Font.weight an integer instead of enumeration
The weight in QFont is an integer, allowing you to request a font
of any weight given the predefined scale. In Qt Quick, however, you
were limited to the predefined values.
This is done in Qt 6 because it breaks conversions from string to
weight, as the change in the autotest illustrates.
[ChangeLog][Font] Made Font.weight an integer value rather than limit
it to a predefined set of weights. As a side effect, conversion from
strings to font weights are no longer supported.
Fixes: QTBUG-80402
Change-Id: Ifbe9a0e608b63bfa93bb54999b0b3c1851ccfa88
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/quick/util/qquickvaluetypes.cpp')
-rw-r--r-- | src/quick/util/qquickvaluetypes.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/quick/util/qquickvaluetypes.cpp b/src/quick/util/qquickvaluetypes.cpp index b47e1a082d..f9cd28cb24 100644 --- a/src/quick/util/qquickvaluetypes.cpp +++ b/src/quick/util/qquickvaluetypes.cpp @@ -634,14 +634,14 @@ void QQuickFontValueType::setBold(bool b) v.setBold(b); } -QQuickFontValueType::FontWeight QQuickFontValueType::weight() const +int QQuickFontValueType::weight() const { - return (QQuickFontValueType::FontWeight)v.weight(); + return v.weight(); } -void QQuickFontValueType::setWeight(QQuickFontValueType::FontWeight w) +void QQuickFontValueType::setWeight(int w) { - v.setWeight((QFont::Weight)w); + v.setWeight(qBound(0, w, 99)); } bool QQuickFontValueType::italic() const |