diff options
-rw-r--r-- | src/quick/items/context2d/qquickcontext2d.cpp | 20 | ||||
-rw-r--r-- | src/quick/items/qquicktext.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquicktextedit.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquicktextinput.cpp | 2 | ||||
-rw-r--r-- | src/quick/util/qquickfontloader.cpp | 2 | ||||
-rw-r--r-- | src/quick/util/qquickglobal.cpp | 2 | ||||
-rw-r--r-- | src/quick/util/qquickvaluetypes.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qml/qqmlvaluetypes/data/font_write.qml | 2 |
8 files changed, 15 insertions, 19 deletions
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index 5a7af4835e..bae9906059 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -452,18 +452,14 @@ static QFont qt_font_from_string(const QString& fontString, const QFont ¤t bool conversionOk = false; int weight = token.toInt(&conversionOk); if (conversionOk) { - if (weight >= 0 && weight <= 99) { - Q_TRY_SET_TOKEN(FontWeight, "<font-weight>", newFont.setWeight(weight)) - continue; - } else { - qWarning().nospace() << "Context2D: Invalid font weight " << weight << " found in font string; " - << "must be between 0 and 99, inclusive."; - return currentFont; - } + Q_TRY_SET_TOKEN(FontWeight, "<font-weight>", + newFont.setWeight(QFont::Weight(weight))) + } else { + // The token is invalid or in the wrong place/order in the font string. + qWarning().nospace() << "Context2D: Invalid or misplaced token " << token + << " found in font string."; + return currentFont; } - // The token is invalid or in the wrong place/order in the font string. - qWarning().nospace() << "Context2D: Invalid or misplaced token " << token << " found in font string."; - return currentFont; } } return newFont; @@ -2793,7 +2789,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_caretBlinkRate(const QV4:: \li font-style (optional): normal | italic | oblique \li font-variant (optional): normal | small-caps - \li font-weight (optional): normal | bold | 0 ... 99 + \li font-weight (optional): normal | bold | 1 ... 1000 \li font-size: Npx | Npt (where N is a positive number) \li font-family: See \l {http://www.w3.org/TR/CSS2/fonts.html#propdef-font-family} \endlist diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index b198c5f114..e89bb49e83 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -1474,7 +1474,7 @@ QQuickText::~QQuickText() \qmlproperty int QtQuick::Text::font.weight The requested weight of the font. The weight requested must be an integer - between 0 and 99, or one of the predefined values: + between 1 and 1000, or one of the predefined values: \list \li Font.Thin \li Font.Light diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index f5a32b8d88..aa07758a5d 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -234,7 +234,7 @@ QString QQuickTextEdit::text() const \qmlproperty int QtQuick::TextEdit::font.weight The requested weight of the font. The weight requested must be an integer - between 0 and 99, or one of the predefined values: + between 1 and 1000, or one of the predefined values: \list \li Font.Thin \li Font.Light diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index db2db9a9d7..64faf4ac33 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -258,7 +258,7 @@ QString QQuickTextInputPrivate::realText() const \qmlproperty int QtQuick::TextInput::font.weight The requested weight of the font. The weight requested must be an integer - between 0 and 99, or one of the predefined values: + between 1 and 1000, or one of the predefined values: \list \li Font.Thin \li Font.Light diff --git a/src/quick/util/qquickfontloader.cpp b/src/quick/util/qquickfontloader.cpp index d6858b486c..2ae5d00739 100644 --- a/src/quick/util/qquickfontloader.cpp +++ b/src/quick/util/qquickfontloader.cpp @@ -309,7 +309,7 @@ void QQuickFontLoader::updateFontInfo(int id) const QFontDatabasePrivate::ApplicationFont::Properties &properties = applicationFont.properties.at(0); font.setFamily(properties.familyName); font.setStyleName(properties.styleName); - font.setWeight(properties.weight); + font.setWeight(QFont::Weight(properties.weight)); font.setStyle(properties.style); font.setStretch(properties.stretch); } diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp index 817977eb3b..fb1645803f 100644 --- a/src/quick/util/qquickglobal.cpp +++ b/src/quick/util/qquickglobal.cpp @@ -528,7 +528,7 @@ public: if (ok) *ok = true; } if (vweight->isInt32()) { - retn.setWeight(vweight->integerValue()); + retn.setWeight(QFont::Weight(vweight->integerValue())); if (ok) *ok = true; } if (vwspac->isNumber()) { diff --git a/src/quick/util/qquickvaluetypes.cpp b/src/quick/util/qquickvaluetypes.cpp index 666156d1cd..b2131b53b7 100644 --- a/src/quick/util/qquickvaluetypes.cpp +++ b/src/quick/util/qquickvaluetypes.cpp @@ -654,7 +654,7 @@ int QQuickFontValueType::weight() const void QQuickFontValueType::setWeight(int w) { - v.setWeight(qBound(0, w, 99)); + v.setWeight(QFont::Weight(w)); } bool QQuickFontValueType::italic() const diff --git a/tests/auto/qml/qqmlvaluetypes/data/font_write.qml b/tests/auto/qml/qqmlvaluetypes/data/font_write.qml index 4d3ae32025..517458fcd5 100644 --- a/tests/auto/qml/qqmlvaluetypes/data/font_write.qml +++ b/tests/auto/qml/qqmlvaluetypes/data/font_write.qml @@ -3,7 +3,7 @@ import Test 1.0 MyTypeObject { font.family: if(1) "Helvetica" font.bold: if(1) false - font.weight: 50 + font.weight: 400 font.italic: if(1) false font.underline: if(1) false font.overline: if(1) false |