From 3fc212f7cad26e310e3f560a9416ad4dfbcaca00 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Fri, 16 Jun 2017 10:12:59 +0200 Subject: Doc: Enclose regular expressions with \badcode Without them, qdoc tries to parse the backslashes as qdoc commands: src/quick/util/qquickvalidator.cpp:231: warning: Unknown command '\d' Change-Id: I36322586c477822f7efbae8b80adaee177c7ca44 Reviewed-by: Venugopal Shivashankar --- src/quick/util/qquickvalidator.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/quick/util') diff --git a/src/quick/util/qquickvalidator.cpp b/src/quick/util/qquickvalidator.cpp index 93f414fe80..c3ce149dcf 100644 --- a/src/quick/util/qquickvalidator.cpp +++ b/src/quick/util/qquickvalidator.cpp @@ -228,9 +228,15 @@ void QQuickDoubleValidator::resetLocaleName() \list \li A list of numbers with one to three positions separated by a comma: + \badcode /\d{1,3}(?:,\d{1,3})+$/ + \endcode + \li An amount consisting of up to 3 numbers before the decimal point, and - 1 to 2 after the decimal point: \li /(\d{1,3})([.,]\d{1,2})?$/ + 1 to 2 after the decimal point: + \badcode + /(\d{1,3})([.,]\d{1,2})?$/ + \endcode \endlist */ -- cgit v1.2.3 From 441e0b41bf5b700cdaa3b0ba2393c487ed4b9de5 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 30 Jun 2017 10:07:29 +0200 Subject: Expose "kerning" property for fonts For text where the content is known, it can be handy to be able to disable the kerning feature in OpenType to improve performance. [ChangeLog][Qt Quick][Text] Added "kerning" property to the font type to support disabling kerning on text. Task-number: QTBUG-56728 Change-Id: I2e447587a066a7e12c5d38967e0845eaad021014 Reviewed-by: Simon Hausmann --- src/quick/util/qquickglobal.cpp | 5 +++++ src/quick/util/qquickvaluetypes.cpp | 10 ++++++++++ src/quick/util/qquickvaluetypes_p.h | 4 ++++ 3 files changed, 19 insertions(+) (limited to 'src/quick/util') diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp index 1d2f3de1df..6df23cdff5 100644 --- a/src/quick/util/qquickglobal.cpp +++ b/src/quick/util/qquickglobal.cpp @@ -302,6 +302,7 @@ public: QV4::ScopedValue vweight(scope, obj->get((s = v4->newString(QStringLiteral("weight"))))); QV4::ScopedValue vwspac(scope, obj->get((s = v4->newString(QStringLiteral("wordSpacing"))))); QV4::ScopedValue vhint(scope, obj->get((s = v4->newString(QStringLiteral("hintingPreference"))))); + QV4::ScopedValue vkerning(scope, obj->get((s = v4->newString(QStringLiteral("kerning"))))); // pull out the values, set ok to true if at least one valid field is given. if (vbold->isBoolean()) { @@ -356,6 +357,10 @@ public: retn.setHintingPreference(static_cast(vhint->integerValue())); if (ok) *ok = true; } + if (vkerning->isBoolean()) { + retn.setKerning(vkerning->booleanValue()); + if (ok) *ok = true; + } return retn; } diff --git a/src/quick/util/qquickvaluetypes.cpp b/src/quick/util/qquickvaluetypes.cpp index 4d34c6d661..bc4a72b6ea 100644 --- a/src/quick/util/qquickvaluetypes.cpp +++ b/src/quick/util/qquickvaluetypes.cpp @@ -757,6 +757,16 @@ void QQuickFontValueType::setHintingPreference(QQuickFontValueType::HintingPrefe v.setHintingPreference(QFont::HintingPreference(hintingPreference)); } +bool QQuickFontValueType::kerning() const +{ + return v.kerning(); +} + +void QQuickFontValueType::setKerning(bool b) +{ + v.setKerning(b); +} + QT_END_NAMESPACE #include "moc_qquickvaluetypes_p.cpp" diff --git a/src/quick/util/qquickvaluetypes_p.h b/src/quick/util/qquickvaluetypes_p.h index 4a1598ec5c..a3f35a84ec 100644 --- a/src/quick/util/qquickvaluetypes_p.h +++ b/src/quick/util/qquickvaluetypes_p.h @@ -323,6 +323,7 @@ class QQuickFontValueType Q_PROPERTY(qreal letterSpacing READ letterSpacing WRITE setLetterSpacing FINAL) Q_PROPERTY(qreal wordSpacing READ wordSpacing WRITE setWordSpacing FINAL) Q_PROPERTY(HintingPreference hintingPreference READ hintingPreference WRITE setHintingPreference FINAL) + Q_PROPERTY(bool kerning READ kerning WRITE setKerning FINAL) public: enum FontWeight { Thin = QFont::Thin, @@ -393,6 +394,9 @@ public: HintingPreference hintingPreference() const; void setHintingPreference(HintingPreference); + + bool kerning() const; + void setKerning(bool b); }; QT_END_NAMESPACE -- cgit v1.2.3 From 432e27ae092397cb2154f48103e729852c38cf2d Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 18 Apr 2017 09:07:07 -0500 Subject: Add very basic compressed texture support Allow direct loading of pkm texture files into Image. This can be extended to additional texture types, and then eventually turned into a full plugin architexture. [ChangeLog][Qt Quick] Allow direct loading of pkm texture files into Image. For example: Image { source: "myImage.pkm" } Change-Id: I1baed6c3e85a15752da8adc675482d874c9355ab Task-number: QTBUG-59872 Task-number: QTBUG-29451 Reviewed-by: Laszlo Agocs --- src/quick/util/qquickpixmapcache.cpp | 45 ++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 7 deletions(-) (limited to 'src/quick/util') diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index e026608150..e218b84fff 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -49,6 +49,7 @@ #include #include +#include #include #include @@ -771,8 +772,26 @@ void QQuickPixmapReader::processJob(QQuickPixmapReply *runningJob, const QUrl &u QFile f(localFile); QSize readSize; if (f.open(QIODevice::ReadOnly)) { - if (!readImage(url, &f, &image, &errorStr, &readSize, runningJob->requestSize, runningJob->providerOptions)) - errorCode = QQuickPixmapReply::Loading; + + // for now, purely use suffix information to determine whether we are working with a compressed texture + QByteArray suffix = QFileInfo(f).suffix().toLower().toLatin1(); + if (QSGTextureReader::isTexture(&f, suffix)) { + QQuickTextureFactory *factory = QSGTextureReader::read(&f, suffix); + if (factory) { + readSize = factory->textureSize(); + } else { + errorStr = QQuickPixmap::tr("Error decoding: %1").arg(url.toString()); + errorCode = QQuickPixmapReply::Decoding; + } + mutex.lock(); + if (!cancelled.contains(runningJob)) + runningJob->postReply(errorCode, errorStr, readSize, factory); + mutex.unlock(); + return; + } else { + if (!readImage(url, &f, &image, &errorStr, &readSize, runningJob->requestSize, runningJob->providerOptions)) + errorCode = QQuickPixmapReply::Loading; + } } else { errorStr = QQuickPixmap::tr("Cannot open: %1").arg(url.toString()); errorCode = QQuickPixmapReply::Loading; @@ -1233,11 +1252,23 @@ static QQuickPixmapData* createPixmapDataSync(QQuickPixmap *declarativePixmap, Q QString errorString; if (f.open(QIODevice::ReadOnly)) { - QImage image; - QQuickImageProviderOptions::AutoTransform appliedTransform = providerOptions.autoTransform(); - if (readImage(url, &f, &image, &errorString, &readSize, requestSize, providerOptions, &appliedTransform)) { - *ok = true; - return new QQuickPixmapData(declarativePixmap, url, QQuickTextureFactory::textureFactoryForImage(image), readSize, requestSize, providerOptions, appliedTransform); + // for now, purely use suffix information to determine whether we are working with a compressed texture + QByteArray suffix = QFileInfo(f).suffix().toLower().toLatin1(); + if (QSGTextureReader::isTexture(&f, suffix)) { + QQuickTextureFactory *factory = QSGTextureReader::read(&f, suffix); + if (factory) { + *ok = true; + return new QQuickPixmapData(declarativePixmap, factory); + } else { + errorString = QQuickPixmap::tr("Error decoding: %1").arg(url.toString()); + } + } else { + QImage image; + QQuickImageProviderOptions::AutoTransform appliedTransform = providerOptions.autoTransform(); + if (readImage(url, &f, &image, &errorString, &readSize, requestSize, providerOptions, &appliedTransform)) { + *ok = true; + return new QQuickPixmapData(declarativePixmap, url, QQuickTextureFactory::textureFactoryForImage(image), readSize, requestSize, providerOptions, appliedTransform); + } } } else { errorString = QQuickPixmap::tr("Cannot open: %1").arg(url.toString()); -- cgit v1.2.3