From f986c0c3390ba7d033b6e6276f63dcd4818adb5c Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 29 Sep 2016 17:35:31 +0200 Subject: Fix crash on cancel QQuickImageResponse We don't need to deleteLater here, we can not be sure that the response won't continue for a bit after this, and it's not even needed since documentation says you need to emit finished in all cases and this will call deleteLater on the response anyway. Task-number: QTBUG-56056 Change-Id: I7cc90620f499beaaaaa61aac77d72d067308838c Reviewed-by: Michael Brasser --- src/quick/util/qquickimageprovider.cpp | 2 ++ src/quick/util/qquickpixmapcache.cpp | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src/quick/util') diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp index d11229717a..9ed38f72c6 100644 --- a/src/quick/util/qquickimageprovider.cpp +++ b/src/quick/util/qquickimageprovider.cpp @@ -181,6 +181,8 @@ QString QQuickImageResponse::errorString() const This method is used to communicate that the response is no longer required by the engine. It may be reimplemented to cancel a request in the provider side, however, it is not mandatory. + + A cancelled QQuickImageResponse still needs to emit finished(). */ void QQuickImageResponse::cancel() { diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 230c31807c..50b6de25fb 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -584,7 +584,6 @@ void QQuickPixmapReader::processJobs() if (asyncResponse) { asyncResponses.remove(asyncResponse); asyncResponse->cancel(); - asyncResponse->deleteLater(); } } PIXMAP_PROFILE(pixmapStateChanged(job->url)); -- cgit v1.2.3 From 3a205800c6ea0a88ae2ab35edabf6883e54a334b Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 6 Jul 2016 12:43:55 +0200 Subject: Doc: add spec on parameter image Error message: Undocumented parameter 'image' in QQuickTextureFactory::textureFactoryForImage() Change-Id: If7cb1e63091c23304b64c5688af0abe55fc37ff4 Reviewed-by: Martin Smith --- src/quick/util/qquickimageprovider.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quick/util') diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp index 6cecf6f6f6..f6a90cb70a 100644 --- a/src/quick/util/qquickimageprovider.cpp +++ b/src/quick/util/qquickimageprovider.cpp @@ -105,7 +105,7 @@ QImage QQuickTextureFactory::image() const } /*! - Returns a QQuickTextureFactory holding the given image. + Returns a QQuickTextureFactory holding the given \a image. This is typically used as a helper in QQuickImageResponse::textureFactory. -- cgit v1.2.3 From 4ee2bc4e9c05d8daec8b04412a0b7c0264fbc1a4 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 15 Aug 2016 10:35:53 +0200 Subject: Turn the no-network support into a configurable feature Change-Id: Ic70f60c124fe166b37fbe9b853735be3c5e0d46d Reviewed-by: Oswald Buddenhagen Reviewed-by: Simon Hausmann --- src/quick/util/qquickfontloader.cpp | 16 ++++++++-------- src/quick/util/qquickpixmapcache.cpp | 26 +++++++++++++------------- 2 files changed, 21 insertions(+), 21 deletions(-) (limited to 'src/quick/util') diff --git a/src/quick/util/qquickfontloader.cpp b/src/quick/util/qquickfontloader.cpp index 6e23d99f7e..d13291c30a 100644 --- a/src/quick/util/qquickfontloader.cpp +++ b/src/quick/util/qquickfontloader.cpp @@ -52,7 +52,7 @@ #include #include -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) #include #include #endif @@ -70,7 +70,7 @@ Q_OBJECT public: explicit QQuickFontObject(int _id = -1); -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) void download(const QUrl &url, QNetworkAccessManager *manager); Q_SIGNALS: @@ -82,7 +82,7 @@ private: private Q_SLOTS: void replyFinished(); -#endif // QT_NO_NETWORK +#endif // qml_network public: int id; @@ -92,7 +92,7 @@ public: QQuickFontObject::QQuickFontObject(int _id) : QObject(0) -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) ,redirectCount(0), reply(0) #endif ,id(_id) @@ -100,7 +100,7 @@ QQuickFontObject::QQuickFontObject(int _id) } -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) void QQuickFontObject::download(const QUrl &url, QNetworkAccessManager *manager) { QNetworkRequest req(url); @@ -141,7 +141,7 @@ void QQuickFontObject::replyFinished() reply = 0; } } -#endif // QT_NO_NETWORK +#endif // qml_network class QQuickFontLoaderPrivate : public QObjectPrivate { @@ -268,7 +268,7 @@ void QQuickFontLoader::setSource(const QUrl &url) } } else { if (!fontLoaderFonts()->map.contains(d->url)) { -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) QQuickFontObject *fo = new QQuickFontObject; fontLoaderFonts()->map[d->url] = fo; fo->download(d->url, qmlEngine(this)->networkAccessManager()); @@ -282,7 +282,7 @@ void QQuickFontLoader::setSource(const QUrl &url) } else { QQuickFontObject *fo = fontLoaderFonts()->map.value(d->url); if (fo->id == -1) { -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) d->status = Loading; emit statusChanged(); QObject::connect(fo, SIGNAL(fontDownloaded(QString,QQuickFontLoader::Status)), diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 9722bf544b..46f6cccc62 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -67,7 +67,7 @@ #include #include -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) #include #include #include @@ -206,7 +206,7 @@ private: friend class QQuickPixmapReaderThreadObject; void processJobs(); void processJob(QQuickPixmapReply *, const QUrl &, const QString &, AutoTransform, QQuickImageProvider::ImageType, QQuickImageProvider *); -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) void networkRequestDone(QNetworkReply *); #endif void asyncResponseFinished(QQuickImageResponse *); @@ -220,7 +220,7 @@ private: QQuickPixmapReaderThreadObject *threadObject; QWaitCondition waitCondition; -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) QNetworkAccessManager *networkAccessManager(); QNetworkAccessManager *accessManager; QHash networkJobs; @@ -349,7 +349,7 @@ QQuickPixmapReply::Event::~Event() delete textureFactory; } -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) QNetworkAccessManager *QQuickPixmapReader::networkAccessManager() { if (!accessManager) { @@ -430,7 +430,7 @@ static bool readImage(const QUrl& url, QIODevice *dev, QImage *image, QString *e QQuickPixmapReader::QQuickPixmapReader(QQmlEngine *eng) : QThread(eng), engine(eng), threadObject(0) -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) , accessManager(0) #endif { @@ -454,7 +454,7 @@ QQuickPixmapReader::~QQuickPixmapReader() delete reply; } jobs.clear(); -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) const auto cancelJob = [this](QQuickPixmapReply *reply) { if (reply->loading) { @@ -476,7 +476,7 @@ QQuickPixmapReader::~QQuickPixmapReader() wait(); } -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) void QQuickPixmapReader::networkRequestDone(QNetworkReply *reply) { QQuickPixmapReply *job = networkJobs.take(reply); @@ -526,7 +526,7 @@ void QQuickPixmapReader::networkRequestDone(QNetworkReply *reply) // kick off event loop again incase we have dropped below max request count threadObject->processJobs(); } -#endif // QT_NO_NETWORK +#endif // qml_network void QQuickPixmapReader::asyncResponseFinished(QQuickImageResponse *response) { @@ -577,7 +577,7 @@ bool QQuickPixmapReaderThreadObject::event(QEvent *e) void QQuickPixmapReaderThreadObject::networkRequestDone() { -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) QNetworkReply *reply = static_cast(sender()); reader->networkRequestDone(reply); #endif @@ -599,7 +599,7 @@ void QQuickPixmapReader::processJobs() // Clean cancelled jobs if (!cancelled.isEmpty()) { -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) for (int i = 0; i < cancelled.count(); ++i) { QQuickPixmapReply *job = cancelled.at(i); QNetworkReply *reply = networkJobs.key(job, 0); @@ -644,7 +644,7 @@ void QQuickPixmapReader::processJobs() } else { localFile = QQmlFile::urlToLocalFileOrQrc(url); usableJob = !localFile.isEmpty() -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) || networkJobs.count() < IMAGEREQUEST_MAX_NETWORK_REQUEST_COUNT #endif ; @@ -772,7 +772,7 @@ void QQuickPixmapReader::processJob(QQuickPixmapReply *runningJob, const QUrl &u runningJob->postReply(errorCode, errorStr, readSize, QQuickTextureFactory::textureFactoryForImage(image)); mutex.unlock(); } else { -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) // Network resource QNetworkRequest req(url); req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true); @@ -841,7 +841,7 @@ void QQuickPixmapReader::cancel(QQuickPixmapReply *reply) void QQuickPixmapReader::run() { if (replyDownloadProgress == -1) { -#ifndef QT_NO_NETWORK +#if QT_CONFIG(qml_network) replyDownloadProgress = QMetaMethod::fromSignal(&QNetworkReply::downloadProgress).methodIndex(); replyFinished = QMetaMethod::fromSignal(&QNetworkReply::finished).methodIndex(); const QMetaObject *ir = &QQuickPixmapReaderThreadObject::staticMetaObject; -- cgit v1.2.3 From 094e1f12945a04507054b5a5bad94b72a7982fb7 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 16 Aug 2016 15:46:30 +0200 Subject: Make Path and PathView configurable Change-Id: Ie9e35612fc274def96d63ef35817c03475077f1f Reviewed-by: Oswald Buddenhagen Reviewed-by: Simon Hausmann --- src/quick/util/qquickpath_p.h | 4 ++++ src/quick/util/qquickpath_p_p.h | 4 ++++ src/quick/util/qquickpathinterpolator_p.h | 4 ++++ src/quick/util/util.pri | 15 ++++++++++----- 4 files changed, 22 insertions(+), 5 deletions(-) (limited to 'src/quick/util') diff --git a/src/quick/util/qquickpath_p.h b/src/quick/util/qquickpath_p.h index fa6cbc668a..457f69d20f 100644 --- a/src/quick/util/qquickpath_p.h +++ b/src/quick/util/qquickpath_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_path); + #include #include diff --git a/src/quick/util/qquickpath_p_p.h b/src/quick/util/qquickpath_p_p.h index 3e4ccc7eb6..1dc3c1c47a 100644 --- a/src/quick/util/qquickpath_p_p.h +++ b/src/quick/util/qquickpath_p_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_path); + #include "qquickpath_p.h" #include diff --git a/src/quick/util/qquickpathinterpolator_p.h b/src/quick/util/qquickpathinterpolator_p.h index ce18190977..0fdb1a444f 100644 --- a/src/quick/util/qquickpathinterpolator_p.h +++ b/src/quick/util/qquickpathinterpolator_p.h @@ -51,6 +51,10 @@ // We mean it. // +#include + +QT_REQUIRE_CONFIG(quick_path); + #include #include diff --git a/src/quick/util/util.pri b/src/quick/util/util.pri index 66792536d7..1ef1018a31 100644 --- a/src/quick/util/util.pri +++ b/src/quick/util/util.pri @@ -17,8 +17,6 @@ SOURCES += \ $$PWD/qquickbehavior.cpp \ $$PWD/qquickfontloader.cpp \ $$PWD/qquickstyledtext.cpp \ - $$PWD/qquickpath.cpp \ - $$PWD/qquickpathinterpolator.cpp \ $$PWD/qquickimageprovider.cpp \ $$PWD/qquicksvgparser.cpp \ $$PWD/qquickvaluetypes.cpp \ @@ -55,9 +53,6 @@ HEADERS += \ $$PWD/qquickbehavior_p.h \ $$PWD/qquickfontloader_p.h \ $$PWD/qquickstyledtext_p.h \ - $$PWD/qquickpath_p.h \ - $$PWD/qquickpath_p_p.h \ - $$PWD/qquickpathinterpolator_p.h \ $$PWD/qquickimageprovider.h \ $$PWD/qquicksvgparser_p.h \ $$PWD/qquickvaluetypes_p.h \ @@ -70,3 +65,13 @@ HEADERS += \ $$PWD/qquicktextmetrics_p.h \ $$PWD/qquickshortcut_p.h \ $$PWD/qquickvalidator_p.h + +qtConfig(quick-path) { + SOURCES += \ + $$PWD/qquickpath.cpp \ + $$PWD/qquickpathinterpolator.cpp + HEADERS += \ + $$PWD/qquickpath_p.h \ + $$PWD/qquickpath_p_p.h \ + $$PWD/qquickpathinterpolator_p.h +} -- cgit v1.2.3 From 0f63a7d09605ca2ca8571edd4a27b3a035fd06a5 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 17 Aug 2016 10:56:30 +0200 Subject: Make shader effects configurable Change-Id: I4e7fd5e9781dec7ee6ed8807ca1a51c937f6f9f3 Reviewed-by: Oswald Buddenhagen Reviewed-by: Simon Hausmann --- src/quick/util/qquickanimator.cpp | 3 ++- src/quick/util/qquickanimator_p.h | 5 +++-- src/quick/util/qquickanimatorjob.cpp | 8 ++++++-- src/quick/util/qquickutilmodule.cpp | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) (limited to 'src/quick/util') diff --git a/src/quick/util/qquickanimator.cpp b/src/quick/util/qquickanimator.cpp index 100b7bd402..5d2af0f940 100644 --- a/src/quick/util/qquickanimator.cpp +++ b/src/quick/util/qquickanimator.cpp @@ -502,7 +502,8 @@ QQuickRotationAnimator::RotationDirection QQuickRotationAnimator::direction() co Q_D(const QQuickRotationAnimator); return d->direction; } -#ifndef QT_NO_OPENGL + +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) /*! \qmltype UniformAnimator \instantiates QQuickUniformAnimator diff --git a/src/quick/util/qquickanimator_p.h b/src/quick/util/qquickanimator_p.h index f1e2d4e1d9..0fc900c5ac 100644 --- a/src/quick/util/qquickanimator_p.h +++ b/src/quick/util/qquickanimator_p.h @@ -169,7 +169,8 @@ protected: QQuickAnimatorJob *createJob() const; QString propertyName() const { return QStringLiteral("rotation"); } }; -#ifndef QT_NO_OPENGL + +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) class QQuickUniformAnimatorPrivate; class Q_QUICK_PRIVATE_EXPORT QQuickUniformAnimator : public QQuickAnimator { @@ -200,7 +201,7 @@ QML_DECLARE_TYPE(QQuickYAnimator) QML_DECLARE_TYPE(QQuickScaleAnimator) QML_DECLARE_TYPE(QQuickRotationAnimator) QML_DECLARE_TYPE(QQuickOpacityAnimator) -#ifndef QT_NO_OPENGL +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) QML_DECLARE_TYPE(QQuickUniformAnimator) #endif #endif // QQUICKANIMATOR_P_H diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp index a0c787dae5..1176cf1ff7 100644 --- a/src/quick/util/qquickanimatorjob.cpp +++ b/src/quick/util/qquickanimatorjob.cpp @@ -43,7 +43,7 @@ #include "qquickanimator_p_p.h" #include #include -#ifndef QT_NO_OPENGL +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) # include # include #endif @@ -329,11 +329,13 @@ void QQuickTransformAnimatorJob::Helper::sync() | QQuickItemPrivate::Size; QQuickItemPrivate *d = QQuickItemPrivate::get(item); +#if QT_CONFIG(quick_shadereffect) if (d->extra.isAllocated() && d->extra->layer && d->extra->layer->enabled()) { d = QQuickItemPrivate::get(d->extra->layer->m_effectSource); } +#endif quint32 dirty = mask & d->dirtyAttributes; @@ -423,11 +425,13 @@ void QQuickOpacityAnimatorJob::initialize(QQuickAnimatorController *controller) { QQuickAnimatorJob::initialize(controller); QQuickItemPrivate *d = QQuickItemPrivate::get(m_target); +#if QT_CONFIG(quick_shadereffect) if (d->extra.isAllocated() && d->extra->layer && d->extra->layer->enabled()) { d = QQuickItemPrivate::get(d->extra->layer->m_effectSource); } +#endif m_opacityNode = d->opacityNode(); if (!m_opacityNode) { @@ -543,7 +547,7 @@ void QQuickRotationAnimatorJob::writeBack() m_target->setRotation(value()); } -#ifndef QT_NO_OPENGL +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) QQuickUniformAnimatorJob::QQuickUniformAnimatorJob() : m_node(0) , m_uniformIndex(-1) diff --git a/src/quick/util/qquickutilmodule.cpp b/src/quick/util/qquickutilmodule.cpp index 66994e22ba..7e2973a78b 100644 --- a/src/quick/util/qquickutilmodule.cpp +++ b/src/quick/util/qquickutilmodule.cpp @@ -107,7 +107,7 @@ void QQuickUtilModule::defineModule() qmlRegisterType("QtQuick", 2, 2, "ScaleAnimator"); qmlRegisterType("QtQuick", 2, 2, "RotationAnimator"); qmlRegisterType("QtQuick", 2, 2, "OpacityAnimator"); -#ifndef QT_NO_OPENGL +#if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) qmlRegisterType("QtQuick", 2, 2, "UniformAnimator"); #endif qmlRegisterType(); -- cgit v1.2.3