diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-05-13 15:31:37 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-08-10 08:55:06 +0000 |
commit | e01bea8999d2f58add58874bd3e6792f509b131b (patch) | |
tree | 7acfa6aff3116b0c986bc1654a9a4c39b2db3f51 /src/quick/util/qquickglobal.cpp | |
parent | c1667cd7277cd48e26a97ea5d10d6bcab0ef576e (diff) |
Font matching by font stylename
Some fonts may have styles that does not directly match to QFont
properties. To support those QFontDatabase supports matching by style
name. This patch exposes that to QML.
Change-Id: I9896f2e3d9f6b56fb51f5694b018b456bcd05ed6
Task-number: QTBUG-30851
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src/quick/util/qquickglobal.cpp')
-rw-r--r-- | src/quick/util/qquickglobal.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp index 6aa7bedc5b..0680a49d6d 100644 --- a/src/quick/util/qquickglobal.cpp +++ b/src/quick/util/qquickglobal.cpp @@ -285,6 +285,7 @@ public: QV4::ScopedValue vbold(scope, obj->get((s = v4->newString(QStringLiteral("bold"))))); QV4::ScopedValue vcap(scope, obj->get((s = v4->newString(QStringLiteral("capitalization"))))); QV4::ScopedValue vfam(scope, obj->get((s = v4->newString(QStringLiteral("family"))))); + QV4::ScopedValue vstyle(scope, obj->get((s = v4->newString(QStringLiteral("styleName"))))); QV4::ScopedValue vital(scope, obj->get((s = v4->newString(QStringLiteral("italic"))))); QV4::ScopedValue vlspac(scope, obj->get((s = v4->newString(QStringLiteral("letterSpacing"))))); QV4::ScopedValue vpixsz(scope, obj->get((s = v4->newString(QStringLiteral("pixelSize"))))); @@ -307,6 +308,10 @@ public: retn.setFamily(vfam->toQString()); if (ok) *ok = true; } + if (vstyle->isString()) { + retn.setStyleName(vstyle->toQString()); + if (ok) *ok = true; + } if (vital->isBoolean()) { retn.setItalic(vital->booleanValue()); if (ok) *ok = true; |