diff options
Diffstat (limited to 'src/quick/util')
-rw-r--r-- | src/quick/util/qquickanimator.cpp | 3 | ||||
-rw-r--r-- | src/quick/util/qquickanimator_p.h | 6 | ||||
-rw-r--r-- | src/quick/util/qquickanimatorjob.cpp | 32 | ||||
-rw-r--r-- | src/quick/util/qquickanimatorjob_p.h | 7 | ||||
-rw-r--r-- | src/quick/util/qquickapplication.cpp | 5 | ||||
-rw-r--r-- | src/quick/util/qquickapplication_p.h | 3 | ||||
-rw-r--r-- | src/quick/util/qquickfontloader.cpp | 37 | ||||
-rw-r--r-- | src/quick/util/qquickglobal.cpp | 5 | ||||
-rw-r--r-- | src/quick/util/qquickpixmapcache.cpp | 59 | ||||
-rw-r--r-- | src/quick/util/qquickprofiler.cpp | 3 | ||||
-rw-r--r-- | src/quick/util/qquickprofiler_p.h | 2 | ||||
-rw-r--r-- | src/quick/util/qquickpropertychanges.cpp | 13 | ||||
-rw-r--r-- | src/quick/util/qquickpropertychanges_p.h | 2 | ||||
-rw-r--r-- | src/quick/util/qquicksmoothedanimation.cpp | 8 | ||||
-rw-r--r-- | src/quick/util/qquickspringanimation.cpp | 3 | ||||
-rw-r--r-- | src/quick/util/qquickstategroup.cpp | 3 | ||||
-rw-r--r-- | src/quick/util/qquickutilmodule.cpp | 3 | ||||
-rw-r--r-- | src/quick/util/qquickvaluetypes.cpp | 10 | ||||
-rw-r--r-- | src/quick/util/qquickvaluetypes_p.h | 12 |
19 files changed, 154 insertions, 62 deletions
diff --git a/src/quick/util/qquickanimator.cpp b/src/quick/util/qquickanimator.cpp index abae6321b0..100b7bd402 100644 --- a/src/quick/util/qquickanimator.cpp +++ b/src/quick/util/qquickanimator.cpp @@ -502,7 +502,7 @@ QQuickRotationAnimator::RotationDirection QQuickRotationAnimator::direction() co Q_D(const QQuickRotationAnimator); return d->direction; } - +#ifndef QT_NO_OPENGL /*! \qmltype UniformAnimator \instantiates QQuickUniformAnimator @@ -580,5 +580,6 @@ QQuickAnimatorJob *QQuickUniformAnimator::createJob() const job->setUniform(u.toLatin1()); return job; } +#endif QT_END_NAMESPACE diff --git a/src/quick/util/qquickanimator_p.h b/src/quick/util/qquickanimator_p.h index c23aa0a7e9..f1e2d4e1d9 100644 --- a/src/quick/util/qquickanimator_p.h +++ b/src/quick/util/qquickanimator_p.h @@ -169,7 +169,7 @@ protected: QQuickAnimatorJob *createJob() const; QString propertyName() const { return QStringLiteral("rotation"); } }; - +#ifndef QT_NO_OPENGL class QQuickUniformAnimatorPrivate; class Q_QUICK_PRIVATE_EXPORT QQuickUniformAnimator : public QQuickAnimator { @@ -190,6 +190,7 @@ protected: QQuickAnimatorJob *createJob() const; QString propertyName() const; }; +#endif QT_END_NAMESPACE @@ -199,6 +200,7 @@ QML_DECLARE_TYPE(QQuickYAnimator) QML_DECLARE_TYPE(QQuickScaleAnimator) QML_DECLARE_TYPE(QQuickRotationAnimator) QML_DECLARE_TYPE(QQuickOpacityAnimator) +#ifndef QT_NO_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 8d5ecadab5..a0c787dae5 100644 --- a/src/quick/util/qquickanimatorjob.cpp +++ b/src/quick/util/qquickanimatorjob.cpp @@ -43,8 +43,10 @@ #include "qquickanimator_p_p.h" #include <private/qquickwindow_p.h> #include <private/qquickitem_p.h> -#include <private/qquickshadereffectnode_p.h> - +#ifndef QT_NO_OPENGL +# include <private/qquickopenglshadereffectnode_p.h> +# include <private/qquickopenglshadereffect_p.h> +#endif #include <private/qanimationgroupjob_p.h> #include <qcoreapplication.h> @@ -173,7 +175,7 @@ void QQuickAnimatorProxyJob::setWindow(QQuickWindow *window) } else if (!m_controller && m_job) { m_controller = QQuickWindowPrivate::get(window)->animationController; - if (window->openglContext()) + if (window->isSceneGraphInitialized()) readyToAnimate(); else connect(window, SIGNAL(sceneGraphInitialized()), this, SLOT(sceneGraphInitialized())); @@ -390,7 +392,6 @@ void QQuickXAnimatorJob::updateCurrentTime(int time) { if (!m_controller) return; - Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); m_value = m_from + (m_to - m_from) * progress(time); m_helper->dx = m_value; @@ -407,7 +408,6 @@ void QQuickYAnimatorJob::updateCurrentTime(int time) { if (!m_controller) return; - Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); m_value = m_from + (m_to - m_from) * progress(time); m_helper->dy = m_value; @@ -477,7 +477,6 @@ void QQuickOpacityAnimatorJob::updateCurrentTime(int time) { if (!m_controller || !m_opacityNode) return; - Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); m_value = m_from + (m_to - m_from) * progress(time); m_opacityNode->setOpacity(m_value); @@ -493,7 +492,6 @@ void QQuickScaleAnimatorJob::updateCurrentTime(int time) { if (!m_controller) return; - Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); m_value = m_from + (m_to - m_from) * progress(time); m_helper->scale = m_value; @@ -513,7 +511,6 @@ void QQuickRotationAnimatorJob::updateCurrentTime(int time) { if (!m_controller) return; - Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); float t = progress(time); @@ -546,6 +543,7 @@ void QQuickRotationAnimatorJob::writeBack() m_target->setRotation(value()); } +#ifndef QT_NO_OPENGL QQuickUniformAnimatorJob::QQuickUniformAnimatorJob() : m_node(0) , m_uniformIndex(-1) @@ -556,7 +554,7 @@ QQuickUniformAnimatorJob::QQuickUniformAnimatorJob() void QQuickUniformAnimatorJob::setTarget(QQuickItem *target) { - if (qobject_cast<QQuickShaderEffect *>(target) != 0) + if (qobject_cast<QQuickOpenGLShaderEffect *>(target) != 0) m_target = target; } @@ -569,14 +567,14 @@ void QQuickUniformAnimatorJob::nodeWasDestroyed() void QQuickUniformAnimatorJob::afterNodeSync() { - m_node = static_cast<QQuickShaderEffectNode *>(QQuickItemPrivate::get(m_target)->paintNode); + m_node = static_cast<QQuickOpenGLShaderEffectNode *>(QQuickItemPrivate::get(m_target)->paintNode); if (m_node && m_uniformIndex == -1 && m_uniformType == -1) { - QQuickShaderEffectMaterial *material = - static_cast<QQuickShaderEffectMaterial *>(m_node->material()); + QQuickOpenGLShaderEffectMaterial *material = + static_cast<QQuickOpenGLShaderEffectMaterial *>(m_node->material()); bool found = false; - for (int t=0; !found && t<QQuickShaderEffectMaterialKey::ShaderTypeCount; ++t) { - const QVector<QQuickShaderEffectMaterial::UniformData> &uniforms = material->uniforms[t]; + for (int t=0; !found && t<QQuickOpenGLShaderEffectMaterialKey::ShaderTypeCount; ++t) { + const QVector<QQuickOpenGLShaderEffectMaterial::UniformData> &uniforms = material->uniforms[t]; for (int i=0; i<uniforms.size(); ++i) { if (uniforms.at(i).name == m_uniform) { m_uniformIndex = i; @@ -594,15 +592,14 @@ void QQuickUniformAnimatorJob::updateCurrentTime(int time) { if (!m_controller) return; - Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); if (!m_node || m_uniformIndex == -1 || m_uniformType == -1) return; m_value = m_from + (m_to - m_from) * progress(time); - QQuickShaderEffectMaterial *material = - static_cast<QQuickShaderEffectMaterial *>(m_node->material()); + QQuickOpenGLShaderEffectMaterial *material = + static_cast<QQuickOpenGLShaderEffectMaterial *>(m_node->material()); material->uniforms[m_uniformType][m_uniformIndex].value = m_value; // As we're not touching the nodes, we need to explicitly mark it dirty. // Otherwise, the renderer will abort repainting if this was the only @@ -615,5 +612,6 @@ void QQuickUniformAnimatorJob::writeBack() if (m_target) m_target->setProperty(m_uniform, value()); } +#endif QT_END_NAMESPACE diff --git a/src/quick/util/qquickanimatorjob_p.h b/src/quick/util/qquickanimatorjob_p.h index 2b910d3737..64e849d322 100644 --- a/src/quick/util/qquickanimatorjob_p.h +++ b/src/quick/util/qquickanimatorjob_p.h @@ -68,7 +68,7 @@ class QQuickAbstractAnimation; class QQuickAnimatorController; class QQuickAnimatorProxyJobPrivate; -class QQuickShaderEffectNode; +class QQuickOpenGLShaderEffectNode; class QSGOpacityNode; @@ -277,7 +277,7 @@ public: private: QSGOpacityNode *m_opacityNode; }; - +#ifndef QT_NO_OPENGL class Q_QUICK_PRIVATE_EXPORT QQuickUniformAnimatorJob : public QQuickAnimatorJob { public: @@ -296,11 +296,12 @@ public: private: QByteArray m_uniform; - QQuickShaderEffectNode *m_node; + QQuickOpenGLShaderEffectNode *m_node; int m_uniformIndex : 8; int m_uniformType : 8; }; +#endif QT_END_NAMESPACE diff --git a/src/quick/util/qquickapplication.cpp b/src/quick/util/qquickapplication.cpp index a4e2f0eb0e..5c26b23ff7 100644 --- a/src/quick/util/qquickapplication.cpp +++ b/src/quick/util/qquickapplication.cpp @@ -90,4 +90,9 @@ Qt::ApplicationState QQuickApplication::state() const return QGuiApplication::applicationState(); } +QFont QQuickApplication::font() const +{ + return QGuiApplication::font(); +} + QT_END_NAMESPACE diff --git a/src/quick/util/qquickapplication_p.h b/src/quick/util/qquickapplication_p.h index 971c9a203a..091cb094ed 100644 --- a/src/quick/util/qquickapplication_p.h +++ b/src/quick/util/qquickapplication_p.h @@ -52,6 +52,7 @@ // #include <QtCore/QObject> +#include <QtGui/QFont> #include <qqml.h> #include <QtQml/private/qqmlglobal_p.h> #include <private/qtquickglobal_p.h> @@ -66,6 +67,7 @@ class Q_AUTOTEST_EXPORT QQuickApplication : public QQmlApplication Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection NOTIFY layoutDirectionChanged) Q_PROPERTY(bool supportsMultipleWindows READ supportsMultipleWindows CONSTANT) Q_PROPERTY(Qt::ApplicationState state READ state NOTIFY stateChanged) + Q_PROPERTY(QFont font READ font CONSTANT) public: explicit QQuickApplication(QObject *parent = 0); @@ -74,6 +76,7 @@ public: Qt::LayoutDirection layoutDirection() const; bool supportsMultipleWindows() const; Qt::ApplicationState state() const; + QFont font() const; Q_SIGNALS: void activeChanged(); diff --git a/src/quick/util/qquickfontloader.cpp b/src/quick/util/qquickfontloader.cpp index 64fd458ef0..b7367f3934 100644 --- a/src/quick/util/qquickfontloader.cpp +++ b/src/quick/util/qquickfontloader.cpp @@ -45,14 +45,18 @@ #include <QStringList> #include <QUrl> #include <QDebug> -#include <QNetworkRequest> -#include <QNetworkReply> + #include <QFontDatabase> #include <private/qobject_p.h> #include <qqmlinfo.h> #include <qqmlfile.h> +#ifndef QT_NO_NETWORK +#include <QNetworkRequest> +#include <QNetworkReply> +#endif + #include <QtCore/QCoreApplication> QT_BEGIN_NAMESPACE @@ -66,28 +70,37 @@ Q_OBJECT public: explicit QQuickFontObject(int _id = -1); +#ifndef QT_NO_NETWORK void download(const QUrl &url, QNetworkAccessManager *manager); Q_SIGNALS: void fontDownloaded(const QString&, QQuickFontLoader::Status); +private: + int redirectCount; + QNetworkReply *reply; + private Q_SLOTS: void replyFinished(); +#endif // QT_NO_NETWORK public: int id; -private: - QNetworkReply *reply; - int redirectCount; - Q_DISABLE_COPY(QQuickFontObject) }; QQuickFontObject::QQuickFontObject(int _id) - : QObject(0), id(_id), reply(0), redirectCount(0) {} + : QObject(0) +#ifndef QT_NO_NETWORK + ,redirectCount(0), reply(0) +#endif + ,id(_id) +{ +} +#ifndef QT_NO_NETWORK void QQuickFontObject::download(const QUrl &url, QNetworkAccessManager *manager) { QNetworkRequest req(url); @@ -128,7 +141,7 @@ void QQuickFontObject::replyFinished() reply = 0; } } - +#endif // QT_NO_NETWORK class QQuickFontLoaderPrivate : public QObjectPrivate { @@ -255,6 +268,7 @@ void QQuickFontLoader::setSource(const QUrl &url) } } else { if (!fontLoaderFonts()->map.contains(d->url)) { +#ifndef QT_NO_NETWORK QQuickFontObject *fo = new QQuickFontObject; fontLoaderFonts()->map[d->url] = fo; fo->download(d->url, qmlEngine(this)->networkAccessManager()); @@ -262,13 +276,20 @@ void QQuickFontLoader::setSource(const QUrl &url) emit statusChanged(); QObject::connect(fo, SIGNAL(fontDownloaded(QString,QQuickFontLoader::Status)), this, SLOT(updateFontInfo(QString,QQuickFontLoader::Status))); +#else +// Silently fail if compiled with no_network +#endif } else { QQuickFontObject *fo = fontLoaderFonts()->map[d->url]; if (fo->id == -1) { +#ifndef QT_NO_NETWORK d->status = Loading; emit statusChanged(); QObject::connect(fo, SIGNAL(fontDownloaded(QString,QQuickFontLoader::Status)), this, SLOT(updateFontInfo(QString,QQuickFontLoader::Status))); +#else +// Silently fail if compiled with no_network +#endif } else updateFontInfo(QFontDatabase::applicationFontFamilies(fo->id).at(0), Ready); diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp index be4c968ab2..7692cc79f9 100644 --- a/src/quick/util/qquickglobal.cpp +++ b/src/quick/util/qquickglobal.cpp @@ -301,6 +301,7 @@ public: QV4::ScopedValue vundl(scope, obj->get((s = v4->newString(QStringLiteral("underline"))))); 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"))))); // pull out the values, set ok to true if at least one valid field is given. if (vbold->isBoolean()) { @@ -351,6 +352,10 @@ public: retn.setWordSpacing(vwspac->asDouble()); if (ok) *ok = true; } + if (vhint->isInt32()) { + retn.setHintingPreference(static_cast<QFont::HintingPreference>(vhint->integerValue())); + if (ok) *ok = true; + } return retn; } diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 6dee84b005..dc4b27d738 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -38,7 +38,6 @@ ****************************************************************************/ #include "qquickpixmapcache_p.h" -#include <qqmlnetworkaccessmanagerfactory.h> #include <qquickimageprovider.h> #include <qqmlengine.h> @@ -55,7 +54,6 @@ #include <QCoreApplication> #include <QImageReader> #include <QHash> -#include <QNetworkReply> #include <QPixmapCache> #include <QFile> #include <QThread> @@ -66,10 +64,15 @@ #include <QWaitCondition> #include <QtCore/qdebug.h> #include <private/qobject_p.h> -#include <QSslError> #include <QQmlFile> #include <QMetaMethod> +#ifndef QT_NO_NETWORK +#include <qqmlnetworkaccessmanagerfactory.h> +#include <QNetworkReply> +#include <QSslError> +#endif + #include <private/qquickprofiler_p.h> #define IMAGEREQUEST_MAX_NETWORK_REQUEST_COUNT 8 @@ -203,7 +206,9 @@ private: friend class QQuickPixmapReaderThreadObject; void processJobs(); void processJob(QQuickPixmapReply *, const QUrl &, const QString &, AutoTransform, QQuickImageProvider::ImageType, QQuickImageProvider *); +#ifndef QT_NO_NETWORK void networkRequestDone(QNetworkReply *); +#endif void asyncResponseFinished(QQuickImageResponse *); QList<QQuickPixmapReply*> jobs; @@ -215,10 +220,11 @@ private: QQuickPixmapReaderThreadObject *threadObject; QWaitCondition waitCondition; +#ifndef QT_NO_NETWORK QNetworkAccessManager *networkAccessManager(); QNetworkAccessManager *accessManager; - QHash<QNetworkReply*,QQuickPixmapReply*> networkJobs; +#endif QHash<QQuickImageResponse*,QQuickPixmapReply*> asyncResponses; static int replyDownloadProgress; @@ -343,6 +349,7 @@ QQuickPixmapReply::Event::~Event() delete textureFactory; } +#ifndef QT_NO_NETWORK QNetworkAccessManager *QQuickPixmapReader::networkAccessManager() { if (!accessManager) { @@ -351,6 +358,7 @@ QNetworkAccessManager *QQuickPixmapReader::networkAccessManager() } return accessManager; } +#endif static void maybeRemoveAlpha(QImage *image) { @@ -421,7 +429,10 @@ static bool readImage(const QUrl& url, QIODevice *dev, QImage *image, QString *e } QQuickPixmapReader::QQuickPixmapReader(QQmlEngine *eng) -: QThread(eng), engine(eng), threadObject(0), accessManager(0) +: QThread(eng), engine(eng), threadObject(0) +#ifndef QT_NO_NETWORK +, accessManager(0) +#endif { eventLoopQuitHack = new QObject; eventLoopQuitHack->moveToThread(this); @@ -443,13 +454,21 @@ QQuickPixmapReader::~QQuickPixmapReader() delete reply; } jobs.clear(); - QList<QQuickPixmapReply*> activeJobs = networkJobs.values() + asyncResponses.values(); - foreach (QQuickPixmapReply *reply, activeJobs ) { +#ifndef QT_NO_NETWORK + + const auto cancelJob = [this](QQuickPixmapReply *reply) { if (reply->loading) { cancelled.append(reply); reply->data = 0; } - } + }; + + for (auto *reply : qAsConst(networkJobs)) + cancelJob(reply); + + for (auto *reply : qAsConst(asyncResponses)) + cancelJob(reply); +#endif if (threadObject) threadObject->processJobs(); mutex.unlock(); @@ -457,6 +476,7 @@ QQuickPixmapReader::~QQuickPixmapReader() wait(); } +#ifndef QT_NO_NETWORK void QQuickPixmapReader::networkRequestDone(QNetworkReply *reply) { QQuickPixmapReply *job = networkJobs.take(reply); @@ -506,6 +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 void QQuickPixmapReader::asyncResponseFinished(QQuickImageResponse *response) { @@ -556,8 +577,10 @@ bool QQuickPixmapReaderThreadObject::event(QEvent *e) void QQuickPixmapReaderThreadObject::networkRequestDone() { +#ifndef QT_NO_NETWORK QNetworkReply *reply = static_cast<QNetworkReply *>(sender()); reader->networkRequestDone(reply); +#endif } void QQuickPixmapReaderThreadObject::asyncResponseFinished() @@ -576,6 +599,7 @@ void QQuickPixmapReader::processJobs() // Clean cancelled jobs if (!cancelled.isEmpty()) { +#ifndef QT_NO_NETWORK for (int i = 0; i < cancelled.count(); ++i) { QQuickPixmapReply *job = cancelled.at(i); QNetworkReply *reply = networkJobs.key(job, 0); @@ -598,6 +622,7 @@ void QQuickPixmapReader::processJobs() job->deleteLater(); } cancelled.clear(); +#endif } if (!jobs.isEmpty()) { @@ -618,7 +643,11 @@ void QQuickPixmapReader::processJobs() usableJob = true; } else { localFile = QQmlFile::urlToLocalFileOrQrc(url); - usableJob = !localFile.isEmpty() || networkJobs.count() < IMAGEREQUEST_MAX_NETWORK_REQUEST_COUNT; + usableJob = !localFile.isEmpty() +#ifndef QT_NO_NETWORK + || networkJobs.count() < IMAGEREQUEST_MAX_NETWORK_REQUEST_COUNT +#endif + ; } @@ -743,6 +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 // Network resource QNetworkRequest req(url); req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true); @@ -752,6 +782,9 @@ void QQuickPixmapReader::processJob(QQuickPixmapReply *runningJob, const QUrl &u QMetaObject::connect(reply, replyFinished, threadObject, threadNetworkRequestDone); networkJobs.insert(reply, runningJob); +#else +// Silently fail if compiled with no_network +#endif } } } @@ -808,11 +841,13 @@ void QQuickPixmapReader::cancel(QQuickPixmapReply *reply) void QQuickPixmapReader::run() { if (replyDownloadProgress == -1) { +#ifndef QT_NO_NETWORK replyDownloadProgress = QMetaMethod::fromSignal(&QNetworkReply::downloadProgress).methodIndex(); replyFinished = QMetaMethod::fromSignal(&QNetworkReply::finished).methodIndex(); - downloadProgress = QMetaMethod::fromSignal(&QQuickPixmapReply::downloadProgress).methodIndex(); const QMetaObject *ir = &QQuickPixmapReaderThreadObject::staticMetaObject; threadNetworkRequestDone = ir->indexOfSlot("networkRequestDone()"); +#endif + downloadProgress = QMetaMethod::fromSignal(&QQuickPixmapReply::downloadProgress).methodIndex(); } mutex.lock(); @@ -887,15 +922,13 @@ QQuickPixmapStore::~QQuickPixmapStore() #ifndef QT_NO_DEBUG int leakedPixmaps = 0; #endif - QList<QQuickPixmapData*> cachedData = m_cache.values(); - // Prevent unreferencePixmap() from assuming it needs to kick // off the cache expiry timer, as we're shrinking the cache // manually below after releasing all the pixmaps. m_timerId = -2; // unreference all (leaked) pixmaps - foreach (QQuickPixmapData* pixmap, cachedData) { + for (auto *pixmap : qAsConst(m_cache)) { int currRefCount = pixmap->refCount; if (currRefCount) { #ifndef QT_NO_DEBUG diff --git a/src/quick/util/qquickprofiler.cpp b/src/quick/util/qquickprofiler.cpp index f8d090cc2c..659ffe1d84 100644 --- a/src/quick/util/qquickprofiler.cpp +++ b/src/quick/util/qquickprofiler.cpp @@ -110,8 +110,9 @@ void QQuickProfiler::stopProfilingImpl() m_data.clear(); } -void QQuickProfiler::reportDataImpl() +void QQuickProfiler::reportDataImpl(bool trackLocations) { + Q_UNUSED(trackLocations); QMutexLocker lock(&m_dataMutex); emit dataReady(m_data); m_data.clear(); diff --git a/src/quick/util/qquickprofiler_p.h b/src/quick/util/qquickprofiler_p.h index b58d4f47c1..f1af87f4e6 100644 --- a/src/quick/util/qquickprofiler_p.h +++ b/src/quick/util/qquickprofiler_p.h @@ -353,7 +353,7 @@ signals: protected slots: void startProfilingImpl(quint64 features); void stopProfilingImpl(); - void reportDataImpl(); + void reportDataImpl(bool trackLocations); void setTimer(const QElapsedTimer &t); }; diff --git a/src/quick/util/qquickpropertychanges.cpp b/src/quick/util/qquickpropertychanges.cpp index 0119aecb7e..df65e0822b 100644 --- a/src/quick/util/qquickpropertychanges.cpp +++ b/src/quick/util/qquickpropertychanges.cpp @@ -46,7 +46,6 @@ #include <private/qqmlcustomparser_p.h> #include <qqmlexpression.h> #include <private/qqmlbinding_p.h> -#include <private/qqmlcompiler_p.h> #include <qqmlcontext.h> #include <private/qqmlproperty_p.h> #include <private/qqmlcontext_p.h> @@ -202,7 +201,7 @@ public: QPointer<QObject> object; QList<const QV4::CompiledData::Binding *> bindings; - QQmlRefPointer<QQmlCompiledData> cdata; + QQmlRefPointer<QV4::CompiledData::CompilationUnit> compilationUnit; bool decoded : 1; bool restore : 1; @@ -258,7 +257,7 @@ void QQuickPropertyChangesPrivate::decode() return; foreach (const QV4::CompiledData::Binding *binding, bindings) - decodeBinding(QString(), cdata->compilationUnit->data, binding); + decodeBinding(QString(), compilationUnit->data, binding); bindings.clear(); @@ -288,7 +287,7 @@ void QQuickPropertyChangesPrivate::decodeBinding(const QString &propertyPrefix, QQuickReplaceSignalHandler *handler = new QQuickReplaceSignalHandler; handler->property = prop; handler->expression.take(new QQmlBoundSignalExpression(object, QQmlPropertyPrivate::get(prop)->signalIndex(), - QQmlContextData::get(qmlContext(q)), object, cdata->compilationUnit->runtimeFunctions[binding->value.compiledScriptIndex])); + QQmlContextData::get(qmlContext(q)), object, compilationUnit->runtimeFunctions[binding->value.compiledScriptIndex])); signalReplacements << handler; return; } @@ -338,12 +337,12 @@ void QQuickPropertyChangesParser::verifyBindings(const QV4::CompiledData::Unit * verifyList(qmlUnit, props.at(ii)); } -void QQuickPropertyChangesParser::applyBindings(QObject *obj, QQmlCompiledData *cdata, const QList<const QV4::CompiledData::Binding *> &bindings) +void QQuickPropertyChangesParser::applyBindings(QObject *obj, QV4::CompiledData::CompilationUnit *compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings) { QQuickPropertyChangesPrivate *p = static_cast<QQuickPropertyChangesPrivate *>(QObjectPrivate::get(obj)); p->bindings = bindings; - p->cdata = cdata; + p->compilationUnit = compilationUnit; p->decoded = false; } @@ -456,7 +455,7 @@ QQuickPropertyChanges::ActionList QQuickPropertyChanges::actions() QQmlBinding *newBinding = 0; if (e.id != QQmlBinding::Invalid) { QV4::Scope scope(QQmlEnginePrivate::getV4Engine(qmlEngine(this))); - QV4::ScopedValue function(scope, QV4::FunctionObject::createQmlFunction(context, object(), d->cdata->compilationUnit->runtimeFunctions[e.id])); + QV4::ScopedValue function(scope, QV4::FunctionObject::createQmlFunction(context, object(), d->compilationUnit->runtimeFunctions[e.id])); newBinding = new QQmlBinding(function, object(), context); } // QQmlBinding *newBinding = e.id != QQmlBinding::Invalid ? QQmlBinding::createBinding(e.id, object(), qmlContext(this)) : 0; diff --git a/src/quick/util/qquickpropertychanges_p.h b/src/quick/util/qquickpropertychanges_p.h index 9d086b7688..0537750338 100644 --- a/src/quick/util/qquickpropertychanges_p.h +++ b/src/quick/util/qquickpropertychanges_p.h @@ -104,7 +104,7 @@ public: void verifyList(const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding); virtual void verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props); - virtual void applyBindings(QObject *obj, QQmlCompiledData *cdata, const QList<const QV4::CompiledData::Binding *> &bindings); + virtual void applyBindings(QObject *obj, QV4::CompiledData::CompilationUnit *compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings); }; diff --git a/src/quick/util/qquicksmoothedanimation.cpp b/src/quick/util/qquicksmoothedanimation.cpp index b7eadf5e30..569cb37c95 100644 --- a/src/quick/util/qquicksmoothedanimation.cpp +++ b/src/quick/util/qquicksmoothedanimation.cpp @@ -377,9 +377,8 @@ QQuickSmoothedAnimation::~QQuickSmoothedAnimation() } QQuickSmoothedAnimationPrivate::QQuickSmoothedAnimationPrivate() - : anim(0) + : anim(new QSmoothedAnimation) { - anim = new QSmoothedAnimation; } QQuickSmoothedAnimationPrivate::~QQuickSmoothedAnimationPrivate() @@ -393,7 +392,7 @@ QQuickSmoothedAnimationPrivate::~QQuickSmoothedAnimationPrivate() void QQuickSmoothedAnimationPrivate::updateRunningAnimations() { - foreach(QSmoothedAnimation* ease, activeAnimations.values()){ + for (QSmoothedAnimation *ease : qAsConst(activeAnimations)) { ease->maximumEasingTime = anim->maximumEasingTime; ease->reversingMode = anim->reversingMode; ease->velocity = anim->velocity; @@ -445,7 +444,8 @@ QAbstractAnimationJob* QQuickSmoothedAnimation::transition(QQuickStateActions &a anims.insert(ease); } - foreach (QSmoothedAnimation *ease, d->activeAnimations.values()){ + const auto copy = d->activeAnimations; + for (QSmoothedAnimation *ease : copy) { if (!anims.contains(ease)) { ease->clearTemplate(); d->activeAnimations.remove(ease->target); diff --git a/src/quick/util/qquickspringanimation.cpp b/src/quick/util/qquickspringanimation.cpp index df077350e9..d2bc3b4ece 100644 --- a/src/quick/util/qquickspringanimation.cpp +++ b/src/quick/util/qquickspringanimation.cpp @@ -585,7 +585,8 @@ QAbstractAnimationJob* QQuickSpringAnimation::transition(QQuickStateActions &act animation->restart(); anims.insert(animation); } - foreach (QSpringAnimation *anim, d->activeAnimations.values()){ + const auto copy = d->activeAnimations; + for (QSpringAnimation *anim : copy) { if (!anims.contains(anim)) { anim->clearTemplate(); d->activeAnimations.remove(anim->target); diff --git a/src/quick/util/qquickstategroup.cpp b/src/quick/util/qquickstategroup.cpp index c163b401fb..200f243a1b 100644 --- a/src/quick/util/qquickstategroup.cpp +++ b/src/quick/util/qquickstategroup.cpp @@ -44,7 +44,6 @@ #include <private/qqmlbinding_p.h> #include <private/qqmlglobal_p.h> -#include <QtCore/qstringbuilder.h> #include <QtCore/qstringlist.h> #include <QtCore/qdebug.h> #include <QtCore/qvector.h> @@ -306,7 +305,7 @@ void QQuickStateGroup::componentComplete() for (int ii = 0; ii < d->states.count(); ++ii) { QQuickState *state = d->states.at(ii); if (!state->isNamed()) - state->setName(QLatin1String("anonymousState") % QString::number(++d->unnamedCount)); + state->setName(QLatin1String("anonymousState") + QString::number(++d->unnamedCount)); } if (d->updateAutoState()) { diff --git a/src/quick/util/qquickutilmodule.cpp b/src/quick/util/qquickutilmodule.cpp index f5d11c6230..66994e22ba 100644 --- a/src/quick/util/qquickutilmodule.cpp +++ b/src/quick/util/qquickutilmodule.cpp @@ -107,8 +107,9 @@ void QQuickUtilModule::defineModule() qmlRegisterType<QQuickScaleAnimator>("QtQuick", 2, 2, "ScaleAnimator"); qmlRegisterType<QQuickRotationAnimator>("QtQuick", 2, 2, "RotationAnimator"); qmlRegisterType<QQuickOpacityAnimator>("QtQuick", 2, 2, "OpacityAnimator"); +#ifndef QT_NO_OPENGL qmlRegisterType<QQuickUniformAnimator>("QtQuick", 2, 2, "UniformAnimator"); - +#endif qmlRegisterType<QQuickStateOperation>(); qmlRegisterCustomType<QQuickPropertyChanges>("QtQuick",2,0,"PropertyChanges", new QQuickPropertyChangesParser); diff --git a/src/quick/util/qquickvaluetypes.cpp b/src/quick/util/qquickvaluetypes.cpp index 416a325238..7b9b6068bd 100644 --- a/src/quick/util/qquickvaluetypes.cpp +++ b/src/quick/util/qquickvaluetypes.cpp @@ -676,4 +676,14 @@ void QQuickFontValueType::setWordSpacing(qreal size) v.setWordSpacing(size); } +QQuickFontValueType::HintingPreference QQuickFontValueType::hintingPreference() const +{ + return QQuickFontValueType::HintingPreference(v.hintingPreference()); +} + +void QQuickFontValueType::setHintingPreference(QQuickFontValueType::HintingPreference hintingPreference) +{ + v.setHintingPreference(QFont::HintingPreference(hintingPreference)); +} + QT_END_NAMESPACE diff --git a/src/quick/util/qquickvaluetypes_p.h b/src/quick/util/qquickvaluetypes_p.h index 80b9ce3109..05e954f915 100644 --- a/src/quick/util/qquickvaluetypes_p.h +++ b/src/quick/util/qquickvaluetypes_p.h @@ -304,6 +304,7 @@ class QQuickFontValueType Q_PROPERTY(Capitalization capitalization READ capitalization WRITE setCapitalization FINAL) 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) public: enum FontWeight { Thin = QFont::Thin, @@ -323,6 +324,14 @@ public: Capitalize = QFont::Capitalize }; Q_ENUM(Capitalization) + enum HintingPreference { + PreferDefaultHinting = QFont::PreferDefaultHinting, + PreferNoHinting = QFont::PreferNoHinting, + PreferVerticalHinting = QFont::PreferVerticalHinting, + PreferFullHinting = QFont::PreferFullHinting + }; + Q_ENUM(HintingPreference) + Q_INVOKABLE QString toString() const; QString family() const; @@ -363,6 +372,9 @@ public: qreal wordSpacing() const; void setWordSpacing(qreal spacing); + + HintingPreference hintingPreference() const; + void setHintingPreference(HintingPreference); }; QT_END_NAMESPACE |