diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-02-07 17:06:03 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-02-07 17:07:44 +0100 |
commit | b907a01b467b551756b108f6c9a04d7e7382ae64 (patch) | |
tree | 2d21d785186ce485f615034e6667d9673b62a4fc | |
parent | 4f8537ff8c9427705e3587861a62fe81cf3e503b (diff) | |
parent | 1d29d8edf8e4e709ca2f27791cdf8672c15488f3 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
examples/quick/textureprovider/etcprovider.h
src/plugins/qmltooling/qmldbg_ost/qmlostplugin.cpp
src/qml/doc/qtqml.qdocconf
src/quick/doc/qtquick.qdocconf
tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
Change-Id: I5027b0ee024e00b9525bd45516b7f401ff7d4ae4
43 files changed, 337 insertions, 78 deletions
diff --git a/dist/changes-5.0.1 b/dist/changes-5.0.1 index d19b58f0de..d0d6d1844e 100644 --- a/dist/changes-5.0.1 +++ b/dist/changes-5.0.1 @@ -28,6 +28,7 @@ General Improvements - qmltest: Added the possibility to use QApplication - [QTBUG-28611] Quick tests: Introduce QQmlMessageHandler. - Compile with QT_NO_WHEELEVENT. + - Various documentation improvements. **************************************************************************** * Library * diff --git a/examples/qmltest/qmltest/qmltest.pro b/examples/qmltest/qmltest/qmltest.pro index 3ade5f2cbd..b5893c5a1e 100644 --- a/examples/qmltest/qmltest/qmltest.pro +++ b/examples/qmltest/qmltest/qmltest.pro @@ -1,11 +1,26 @@ TEMPLATE=app TARGET=tst_qmltestexample -CONFIG += qmltestcase + SOURCES += tst_qmltest.cpp -# Note: Normally, tests are auto-installed to a test-specific directory. Overwritten here -# so this one will end up in the examples tree. -target.path = $$[QT_INSTALL_EXAMPLES]/qmltest +!QTDIR_build { +# This is the code actual testcases should use: + +CONFIG += qmltestcase + +TESTDATA += tst_basic.qml tst_item.qml + +} else { +# This code exists solely for the purpose of building this example +# inside the examples/ hierarchy. + +QT += qml qmltest + +macx: CONFIG -= app_bundle + +target.path = $$[QT_INSTALL_EXAMPLES]/qmltest/qmltest qml.files = tst_basic.qml tst_item.qml -qml.path = $$[QT_INSTALL_EXAMPLES]/qmltest +qml.path = $$[QT_INSTALL_EXAMPLES]/qmltest/qmltest INSTALLS += target qml + +} diff --git a/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc b/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc index 818d76b7bf..1de194b962 100644 --- a/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc +++ b/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc @@ -38,7 +38,7 @@ \snippet quick/particles/imageparticle/content/allatonce.qml 0 Colored shows a simple ImageParticle with some color variation. - \snippet particles/imageparticle/content/colored.qml 0 + \snippet quick/particles/imageparticle/content/colored.qml 0 Color Table sets the color over life on the particles to provide a fixed rainbow effect. \snippet quick/particles/imageparticle/content/colortable.qml 0 diff --git a/examples/quick/particles/particles.pro b/examples/quick/particles/particles.pro index 9200113be8..2ea61751fb 100644 --- a/examples/quick/particles/particles.pro +++ b/examples/quick/particles/particles.pro @@ -6,6 +6,7 @@ SUBDIRS += affectors \ system EXAMPLE_FILES = \ + images.qrc \ itemparticle #Install shared images too diff --git a/examples/quick/shared/quick_shared.qrc b/examples/quick/shared/quick_shared.qrc index 9fc114dc89..74a964e5ef 100644 --- a/examples/quick/shared/quick_shared.qrc +++ b/examples/quick/shared/quick_shared.qrc @@ -4,5 +4,6 @@ <file>SimpleLauncherDelegate.qml</file> <file>Button.qml</file> <file>images/back.png</file> + <file>images/next.png</file> </qresource> </RCC> diff --git a/examples/quick/shared/shared.qrc b/examples/quick/shared/shared.qrc index 4ac856e66b..0c9f39e7b0 100644 --- a/examples/quick/shared/shared.qrc +++ b/examples/quick/shared/shared.qrc @@ -4,5 +4,6 @@ <file>SimpleLauncherDelegate.qml</file> <file>Button.qml</file> <file>images/back.png</file> + <file>images/next.png</file> </qresource> </RCC> diff --git a/examples/quick/textureprovider/etcprovider.h b/examples/quick/textureprovider/etcprovider.h index 4215ea297b..08418f8b4b 100644 --- a/examples/quick/textureprovider/etcprovider.h +++ b/examples/quick/textureprovider/etcprovider.h @@ -59,6 +59,7 @@ public: class EtcTexture : public QSGTexture { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qml.QmlOstPlugin") public: EtcTexture(); ~EtcTexture(); diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.cpp b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.cpp index f9b8ce6078..9da7a4a540 100644 --- a/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.cpp +++ b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.cpp @@ -52,6 +52,3 @@ void DialogPlugin::registerTypes(const char *uri){ //qRegisterMetaType<QQmlListProperty<QString> > ("QQmlListProperty<QString>"); } - -//FileDialog is the plugin name (same as the TARGET in the project file) and DialogPlugin is the plugin classs -Q_EXPORT_PLUGIN2(FileDialog, DialogPlugin); diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.h b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.h index 54b374621c..58248ffcac 100644 --- a/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.h +++ b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.h @@ -46,7 +46,7 @@ class DialogPlugin : public QQmlExtensionPlugin { Q_OBJECT - + Q_PLUGIN_METADATA(IID "org.qt-project.QmlExtensionPlugin.FileDialog") public: //registerTypes is inherited from QQmlExtensionPlugin void registerTypes(const char *uri); diff --git a/examples/quick/window/window/window.pro b/examples/quick/window/window/window.pro index e62decb733..3525a893fa 100644 --- a/examples/quick/window/window/window.pro +++ b/examples/quick/window/window/window.pro @@ -4,5 +4,10 @@ QT += qml SOURCES += window.cpp RESOURCES += window.qrc +EXAMPLE_FILES = \ + nogui.qml \ + standalone.qml \ + twowindows.qml + target.path = $$[QT_INSTALL_EXAMPLES]/quick/window/window INSTALLS = target diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp index bb6edb26a5..e0572ef424 100644 --- a/src/particles/qquickimageparticle.cpp +++ b/src/particles/qquickimageparticle.cpp @@ -128,7 +128,11 @@ static const char vertexShaderCode[] = " fTex = vPosTex.zw;\n" "#endif\n" " highp float currentSize = mix(vData.z, vData.w, t * t);\n" +#if defined (Q_OS_BLACKBERRY) + " highp float fade = 1.;\n" +#else " lowp float fade = 1.;\n" +#endif " highp float fadeIn = min(t * 10., 1.);\n" " highp float fadeOut = 1. - clamp((t - 0.75) * 4.,0., 1.);\n" "\n" diff --git a/src/particles/qquickparticleemitter.cpp b/src/particles/qquickparticleemitter.cpp index eeb0aef715..b4e3a82cb2 100644 --- a/src/particles/qquickparticleemitter.cpp +++ b/src/particles/qquickparticleemitter.cpp @@ -88,7 +88,7 @@ QT_BEGIN_NAMESPACE box of the Emitter. */ /*! - \qmlproperty bool QtQuick.Particles2::Emitter::emitting + \qmlproperty bool QtQuick.Particles2::Emitter::enabled If set to false, the emitter will cease emissions until it is set to true. diff --git a/src/qml/doc/qtqml.qdocconf b/src/qml/doc/qtqml.qdocconf index 45fecc1896..ecd6b81823 100644 --- a/src/qml/doc/qtqml.qdocconf +++ b/src/qml/doc/qtqml.qdocconf @@ -2,20 +2,20 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtQml description = Qt QML Reference Documentation -url = http://qt-project.org/doc/qt-5.0/qtqml -version = 5.1.0 +url = http://qt-project.org/doc/qt-$QT_VER/qtqml +version = $QT_VERSION qhp.projects = QtQml qhp.QtQml.file = qtqml.qhp -qhp.QtQml.namespace = org.qt-project.qtqml.510 +qhp.QtQml.namespace = org.qt-project.qtqml.$QT_VERSION_TAG qhp.QtQml.virtualFolder = qtqml qhp.QtQml.indexTitle = Qt QML qhp.QtQml.indexRoot = -qhp.QtQml.filterAttributes = qtqml 5.1.0 qtrefdoc -qhp.QtQml.customFilters.Qt.name = QtQml 5.1.0 -qhp.QtQml.customFilters.Qt.filterAttributes = qtqml 5.1.0 +qhp.QtQml.filterAttributes = qtqml $QT_VERSION qtrefdoc +qhp.QtQml.customFilters.Qt.name = QtQml $QT_VERSION +qhp.QtQml.customFilters.Qt.filterAttributes = qtqml $QT_VERSION qhp.QtQml.subprojects = classes examples qhp.QtQml.subprojects.classes.title = C++ Classes qhp.QtQml.subprojects.classes.indexTitle = Qt QML Module C++ Classes diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 1928bcb4b5..b335d6f402 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -664,7 +664,7 @@ void QQmlComponentPrivate::loadUrl(const QUrl &newUrl, QQmlComponent::Compilatio if (newUrl.isEmpty()) { QQmlError error; - error.setDescription(q->tr("Invalid empty URL")); + error.setDescription(QQmlComponent::tr("Invalid empty URL")); state.errors << error; return; } diff --git a/src/qml/qml/qqmlextensionplugin.cpp b/src/qml/qml/qqmlextensionplugin.cpp index f824da2bbd..bbc0fed768 100644 --- a/src/qml/qml/qqmlextensionplugin.cpp +++ b/src/qml/qml/qqmlextensionplugin.cpp @@ -58,8 +58,8 @@ QT_BEGIN_NAMESPACE To write a QML extension plugin: \list - \li Subclass QQmlExtensionPlugin, implement registerTypes() method - to register types using qmlRegisterType(), and export the class using the Q_EXPORT_PLUGIN2() macro + \li Subclass QQmlExtensionPlugin, implement registerTypes() method to register types + using qmlRegisterType(), and export the class using the Q_PLUGIN_METADATA() macro \li Write an appropriate project file for the plugin \li Create a \l{Module Definition qmldir Files}{qmldir file} to describe the plugin \endlist @@ -140,7 +140,7 @@ QT_BEGIN_NAMESPACE Constructs a QML extension plugin with the given \a parent. Note that this constructor is invoked automatically by the - Q_EXPORT_PLUGIN2() macro, so there is no need for calling it + Q_PLUGIN_METADATA() macro, so there is no need for calling it explicitly. */ QQmlExtensionPlugin::QQmlExtensionPlugin(QObject *parent) diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index f2573895c6..52d07b23ec 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -208,10 +208,6 @@ public: QQmlTypeLoader *typeLoader; - static inline QString tr(const char *str) { - return QQmlImportDatabase::tr(str); - } - static bool locateQmldir(const QString &uri, int vmaj, int vmin, QQmlImportDatabase *database, QString *outQmldirFilePath, QString *outUrl); @@ -735,7 +731,7 @@ bool QQmlImportsPrivate::importExtension(const QString &qmldirFilePath, // The reason is that the lower level may add url and line/column numbering information. QQmlError poppedError = errors->takeFirst(); QQmlError error; - error.setDescription(tr("plugin cannot be loaded for module \"%1\": %2").arg(uri).arg(poppedError.description())); + error.setDescription(QQmlImportDatabase::tr("plugin cannot be loaded for module \"%1\": %2").arg(uri).arg(poppedError.description())); error.setUrl(QUrl::fromLocalFile(qmldirFilePath)); errors->prepend(error); } @@ -744,7 +740,7 @@ bool QQmlImportsPrivate::importExtension(const QString &qmldirFilePath, } else { if (errors) { QQmlError error; - error.setDescription(tr("module \"%1\" plugin \"%2\" not found").arg(uri).arg(plugin.name)); + error.setDescription(QQmlImportDatabase::tr("module \"%1\" plugin \"%2\" not found").arg(uri).arg(plugin.name)); error.setUrl(QUrl::fromLocalFile(qmldirFilePath)); errors->prepend(error); } @@ -1035,9 +1031,9 @@ bool QQmlImportsPrivate::addLibraryImport(const QString& uri, const QString &pre if (inserted->qmlDirComponents.isEmpty() && inserted->qmlDirScripts.isEmpty()) { QQmlError error; if (QQmlMetaType::isAnyModule(uri)) - error.setDescription(tr("module \"%1\" version %2.%3 is not installed").arg(uri).arg(vmaj).arg(vmin)); + error.setDescription(QQmlImportDatabase::tr("module \"%1\" version %2.%3 is not installed").arg(uri).arg(vmaj).arg(vmin)); else - error.setDescription(tr("module \"%1\" is not installed").arg(uri)); + error.setDescription(QQmlImportDatabase::tr("module \"%1\" is not installed").arg(uri)); errors->prepend(error); return false; } else if ((vmaj >= 0) && (vmin >= 0) && qmldir) { @@ -1082,7 +1078,7 @@ bool QQmlImportsPrivate::addFileImport(const QString& uri, const QString &prefix if (!QQmlFile::bundleDirectoryExists(dir, typeLoader->engine())) { if (!isImplicitImport) { QQmlError error; - error.setDescription(tr("\"%1\": no such directory").arg(uri)); + error.setDescription(QQmlImportDatabase::tr("\"%1\": no such directory").arg(uri)); error.setUrl(QUrl(qmldirUrl)); errors->prepend(error); } @@ -1107,7 +1103,7 @@ bool QQmlImportsPrivate::addFileImport(const QString& uri, const QString &prefix if (!typeLoader->directoryExists(dir)) { if (!isImplicitImport) { QQmlError error; - error.setDescription(tr("\"%1\": no such directory").arg(uri)); + error.setDescription(QQmlImportDatabase::tr("\"%1\": no such directory").arg(uri)); error.setUrl(QUrl(qmldirUrl)); errors->prepend(error); } @@ -1127,7 +1123,7 @@ bool QQmlImportsPrivate::addFileImport(const QString& uri, const QString &prefix if (!isImplicitImport) { QQmlError error; - error.setDescription(tr("import \"%1\" has no qmldir and no namespace").arg(importUri)); + error.setDescription(QQmlImportDatabase::tr("import \"%1\" has no qmldir and no namespace").arg(importUri)); error.setUrl(QUrl(qmldirUrl)); errors->prepend(error); } @@ -1187,9 +1183,9 @@ bool QQmlImportsPrivate::updateQmldirContent(const QString &uri, const QString & if (uri != QLatin1String(".")) { QQmlError error; if (QQmlMetaType::isAnyModule(uri)) - error.setDescription(tr("module \"%1\" version %2.%3 is not installed").arg(uri).arg(vmaj).arg(vmin)); + error.setDescription(QQmlImportDatabase::tr("module \"%1\" version %2.%3 is not installed").arg(uri).arg(vmaj).arg(vmin)); else - error.setDescription(tr("module \"%1\" is not installed").arg(uri)); + error.setDescription(QQmlImportDatabase::tr("module \"%1\" is not installed").arg(uri)); errors->prepend(error); return false; } @@ -1344,6 +1340,7 @@ QQmlImportDatabase::QQmlImportDatabase(QQmlEngine *e) QQmlImportDatabase::~QQmlImportDatabase() { + qDeleteAll(qmldirCache); qmldirCache.clear(); } diff --git a/src/qml/qml/qqmlrewrite.cpp b/src/qml/qml/qqmlrewrite.cpp index 0913a8c224..0e281428ed 100644 --- a/src/qml/qml/qqmlrewrite.cpp +++ b/src/qml/qml/qqmlrewrite.cpp @@ -44,6 +44,7 @@ #include <private/qqmlglobal_p.h> #include <QtCore/qdebug.h> +#include <QtCore/qcoreapplication.h> QT_BEGIN_NAMESPACE @@ -513,8 +514,15 @@ bool RewriteSignalHandler::visit(AST::IdentifierExpression *e) return false; } -static QString unnamed_error_string(QLatin1String(QT_TR_NOOP("Signal uses unnamed parameter followed by named parameter."))); -static QString global_error_string(QLatin1String(QT_TR_NOOP("Signal parameter \"%1\" hides global variable."))); +static inline QString msgUnnamedErrorString() +{ + return QCoreApplication::translate("QQmlRewrite", "Signal uses unnamed parameter followed by named parameter."); +} + +static inline QString msgGlobalErrorString(const QString &p) +{ + return QCoreApplication::translate("QQmlRewrite", "Signal parameter \"%1\" hides global variable.").arg(p); +} #define EXIT_ON_ERROR(error) \ { \ @@ -543,9 +551,9 @@ QString RewriteSignalHandler::createParameterString(const QList<QHashedString> & if (param.isEmpty()) unnamedParam = true; else if (unnamedParam) - EXIT_ON_ERROR(unnamed_error_string) + EXIT_ON_ERROR(msgUnnamedErrorString()) else if (illegalNames.contains(param)) - EXIT_ON_ERROR(global_error_string.arg(param)) + EXIT_ON_ERROR(msgGlobalErrorString(param)) ++_parameterCountForJS; parameters += param; if (i < parameterNameList.count()-1) diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index dc63db1dea..aa7a2d95c7 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -2289,7 +2289,7 @@ void QQmlScriptBlob::done() error.setUrl(finalUrl()); error.setLine(script.location.line); error.setColumn(script.location.column); - error.setDescription(typeLoader()->tr("Script %1 unavailable").arg(script.script->url().toString())); + error.setDescription(QQmlTypeLoader::tr("Script %1 unavailable").arg(script.script->url().toString())); errors.prepend(error); setError(errors); } diff --git a/src/qml/qml/v8/qjsengine.cpp b/src/qml/qml/v8/qjsengine.cpp index acc734d549..5b1464afe6 100644 --- a/src/qml/qml/v8/qjsengine.cpp +++ b/src/qml/qml/v8/qjsengine.cpp @@ -349,7 +349,6 @@ QJSValue QJSEngine::create(int type, const void *ptr) /*! \internal - \since 4.5 convert \a value to \a type, store the result in \a ptr */ bool QJSEngine::convertV2(const QJSValue &value, int type, void *ptr) diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index 3fe3d28b67..2619c1a484 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -813,6 +813,12 @@ QDateTime QV8Engine::qtDateTimeFromJsDate(double jsDate) v8::Persistent<v8::Object> *QV8Engine::findOwnerAndStrength(QObject *object, bool *shouldBeStrong) { + QQmlData *data = QQmlData::get(object); + if (data && data->rootObjectInCreation) { // When the object is still being created it may not show up to the GC. + *shouldBeStrong = true; + return 0; + } + QObject *parent = object->parent(); if (!parent) { // if the object has JS ownership, the object's v8object owns the lifetime of the persistent value. diff --git a/src/quick/doc/images/declarative-colors.png b/src/quick/doc/images/declarative-colors.png Binary files differnew file mode 100644 index 0000000000..f2eacd889b --- /dev/null +++ b/src/quick/doc/images/declarative-colors.png diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf index de50eb2375..7fba78da10 100644 --- a/src/quick/doc/qtquick.qdocconf +++ b/src/quick/doc/qtquick.qdocconf @@ -2,25 +2,25 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtQuick description = Qt Quick Reference Documentation -url = http://qt-project.org/doc/qt-5.0/qtquick-index.html -version = 5.1.0 +url = http://qt-project.org/doc/qt-$QT_VER/qtquick-index.html +version = $QT_VERSION qhp.projects = QtQuick qhp.QtQuick.file = qtquick.qhp -qhp.QtQuick.namespace = org.qt-project.qtquick.510 +qhp.QtQuick.namespace = org.qt-project.qtquick.$QT_VERSION_TAG qhp.QtQuick.virtualFolder = qtquick qhp.QtQuick.indexTitle = Qt Quick qhp.QtQuick.indexRoot = -qhp.QtQuick.filterAttributes = qtquick 5.1.0 qtrefdoc -qhp.QtQuick.customFilters.Qt.name = QtQuick 5.1.0 -qhp.QtQuick.customFilters.Qt.filterAttributes = qtquick 5.1.0 +qhp.QtQuick.filterAttributes = qtquick $QT_VERSION qtrefdoc +qhp.QtQuick.customFilters.Qt.name = QtQuick $QT_VERSION +qhp.QtQuick.customFilters.Qt.filterAttributes = qtquick $QT_VERSION qhp.QtQuick.subprojects = qmltypes classes examples qhp.QtQuick.subprojects.qmltypes.title = QML Types qhp.QtQuick.subprojects.qmltypes.indexTitle = Qt Quick QML Types -qhp.QtQuick.subprojects.qmltypes.selectors = class fake:headerfile +qhp.QtQuick.subprojects.qmltypes.selectors = fake:qmlclass qhp.QtQuick.subprojects.qmltypes.sortPages = true qhp.QtQuick.subprojects.classes.title = Classes qhp.QtQuick.subprojects.classes.title = C++ Classes diff --git a/src/quick/doc/src/appdevguide/deployment.qdoc b/src/quick/doc/src/appdevguide/deployment.qdoc index a6a8d88841..bf98902c17 100644 --- a/src/quick/doc/src/appdevguide/deployment.qdoc +++ b/src/quick/doc/src/appdevguide/deployment.qdoc @@ -208,4 +208,4 @@ be used to build the application resources: See \l {The Qt Resource System} for more information. - +*/ diff --git a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc index 724e94c5d7..e2753e47f4 100644 --- a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc +++ b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc @@ -178,6 +178,8 @@ created directly as elements within QML: \code class MyModelPlugin : public QQmlExtensionPlugin { + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.QmlExtension.MyModel" FILE "mymodel.json") public: void registerTypes(const char *uri) { @@ -185,8 +187,6 @@ public: "MyModel"); } } - -Q_EXPORT_PLUGIN2(mymodelplugin, MyModelPlugin); \endcode \li diff --git a/src/quick/doc/src/tutorial.qdoc b/src/quick/doc/src/tutorial.qdoc index 21a5b8daee..7dbb211cb8 100644 --- a/src/quick/doc/src/tutorial.qdoc +++ b/src/quick/doc/src/tutorial.qdoc @@ -219,7 +219,7 @@ Because we don't want the text to appear at the bottom instantly but rather move we add a transition between our two states. \c from and \c to define the states between which the transition will run. -In this case, we want a transition from the default state to our \li down state. +In this case, we want a transition from the default state to our \e down state. Because we want the same transition to be run in reverse when changing back from the \e down state to the default state, we set \c reversible to \c true. diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index c857a69f75..17115ae8c4 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -2512,7 +2512,7 @@ v8::Handle<v8::Value> ctx2d_pixelArray_indexed_set(uint32_t index, v8::Local<v8: QV8Context2DPixelArrayResource *r = v8_resource_cast<QV8Context2DPixelArrayResource>(info.This()); const int v = value->Uint32Value(); - if (r && index < static_cast<quint32>(r->image.width() * r->image.height() * 4) && v > 0 && v <= 255) { + if (r && index < static_cast<quint32>(r->image.width() * r->image.height() * 4) && v >= 0 && v <= 255) { const quint32 w = r->image.width(); const quint32 row = (index / 4) / w; const quint32 col = (index / 4) % w; diff --git a/src/quick/items/qquickimagebase.cpp b/src/quick/items/qquickimagebase.cpp index 2a9edb37d1..c07f7067f5 100644 --- a/src/quick/items/qquickimagebase.cpp +++ b/src/quick/items/qquickimagebase.cpp @@ -207,6 +207,7 @@ void QQuickImageBase::load() options |= QQuickPixmap::Asynchronous; if (d->cache) options |= QQuickPixmap::Cache; + d->pix.clear(this); d->pix.load(qmlEngine(this), d->url, d->sourcesize, options); if (d->pix.isLoading()) { diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 8e2a8c2ddc..e87f870eb8 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -1706,15 +1706,91 @@ void QQuickItemPrivate::updateSubFocusItem(QQuickItem *scope, bool focus) /*! \enum QQuickItem::ItemChange - \internal + \brief Used in conjunction with QQuickItem::itemChange() to notify + the item about certain types of changes. + + \value ItemChildAddedChange A child was added. ItemChangeData::item contains + the added child. + + \value ItemChildRemovedChange A child was removed. ItemChangeData::item + contains the removed child. + + \value ItemSceneChange The item was added to or removed from a scene. The + QQuickWindow rendering the scene is specified in using ItemChangeData::window. + The window parameter is null when the item is removed from a scene. + + \value ItemVisibleHasChanged The item's visibility has changed. + ItemChangeData::boolValue contains the new visibility. + + \value ItemParentHasChanged The item's parent has changed. + ItemChangeData::item contains the new parent. + + \value ItemOpacityHasChanged The item's opacity has changed. + ItemChangeData::realValue contains the new opacity. + + \value ItemActiveFocusHasChanged The item's focus has changed. + ItemChangeData::boolValue contains whether the item has focus or not. + + \value ItemRotationHasChanged The item's rotation has changed. + ItemChangeData::realValue contains the new rotation. */ /*! \class QQuickItem::ItemChangeData - \internal + \inmodule QtQuick + \brief Adds supplimentary information to the QQuickItem::itemChange() + function. + + The meaning of each member of this class is defined by the change type. + + \sa QQuickItem::ItemChange */ /*! + \fn QQuickItem::ItemChangeData::ItemChangeData(QQuickItem *) + \internal + */ + +/*! + \fn QQuickItem::ItemChangeData::ItemChangeData(QQuickWindow *) + \internal + */ + +/*! + \fn QQuickItem::ItemChangeData::ItemChangeData(qreal) + \internal + */ + +/*! + \fn QQuickItem::ItemChangeData::ItemChangeData(bool) + \internal + */ + +/*! + \variable QQuickItem::ItemChangeData::realValue + Contains supplimentary information to the QQuickItem::itemChange() function. + \sa QQuickItem::ItemChange + */ + +/*! + \variable QQuickItem::ItemChangeData::boolValue + Contains supplimentary information to the QQuickItem::itemChange() function. + \sa QQuickItem::ItemChange + */ + +/*! + \variable QQuickItem::ItemChangeData::item + Contains supplimentary information to the QQuickItem::itemChange() function. + \sa QQuickItem::ItemChange + */ + +/*! + \variable QQuickItem::ItemChangeData::window + Contains supplimentary information to the QQuickItem::itemChange() function. + \sa QQuickItem::ItemChange + */ + +/*! \enum QQuickItem::TransformOrigin Controls the point about which simple transforms like scale apply. @@ -2161,6 +2237,11 @@ void QQuickItem::stackAfter(const QQuickItem *sibling) /*! Returns the window in which this item is rendered. + + The item does not have a window until it has been assigned into a scene. To + get notification about this, reimplement the itemChange() function and + listen for the ItemSceneChange change. The itemChange() function is called + both when the item is entered into a scene and when it is removed from a scene. */ QQuickWindow *QQuickItem::window() const { @@ -4190,7 +4271,10 @@ void QQuickItemPrivate::deliverDragEvent(QEvent *e) #endif // QT_NO_DRAGANDDROP /*! - \internal + Called when \a change occurs for this item. + + \a value contains extra information relating to the change, when + applicable. */ void QQuickItem::itemChange(ItemChange change, const ItemChangeData &value) { diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp index 210132effc..61f9a27d3b 100644 --- a/src/quick/items/qquickloader.cpp +++ b/src/quick/items/qquickloader.cpp @@ -941,7 +941,7 @@ v8::Handle<v8::Object> QQuickLoaderPrivate::extractInitialPropertyValues(QQmlV8F v8::Local<v8::Value> v = (*args)[1]; if (!v->IsObject() || v->IsArray()) { *error = true; - qmlInfo(loader) << loader->tr("setSource: value is not an object"); + qmlInfo(loader) << QQuickLoader::tr("setSource: value is not an object"); } else { *error = false; valuemap = v8::Local<v8::Object>::Cast(v); diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 5a97f77e56..917eaeadd8 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -527,10 +527,13 @@ void QQuickTextPrivate::updateSize() } if (internalWidthUpdate) return; - if (wrapMode != QQuickText::NoWrap && q->widthValid()) + + extra->doc->setPageSize(QSizeF()); + if (q->widthValid() && (wrapMode != QQuickText::NoWrap || extra->doc->idealWidth() < q->width())) extra->doc->setTextWidth(q->width()); else extra->doc->setTextWidth(extra->doc->idealWidth()); // ### Text does not align if width is not set (QTextDoc bug) + widthExceeded = extra->doc->textWidth() < extra->doc->idealWidth(); QSizeF dsize = extra->doc->size(); layedOutTextRect = QRectF(QPointF(0,0), dsize); diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 906758903d..b305ad116a 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -3275,6 +3275,7 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo bool inputMethodAttributesChanged = m_textDirty || m_selDirty; #endif bool alignmentChanged = false; + bool textChanged = false; if (m_textDirty) { // do validation @@ -3309,6 +3310,7 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo } if (m_textDirty) { + textChanged = true; m_textDirty = false; #ifndef QT_NO_IM m_preeditDirty = false; @@ -3344,7 +3346,7 @@ bool QQuickTextInputPrivate::finishChange(int validateFromState, bool update, bo #endif emitUndoRedoChanged(); - if (!emitCursorPositionChanged() && alignmentChanged) + if (!emitCursorPositionChanged() && (alignmentChanged || textChanged)) q->updateCursorRectangle(); return true; diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 086865aec3..ea454367a9 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -1155,8 +1155,6 @@ bool QQuickWindow::event(QEvent *e) case QEvent::Leave: d->clearHover(); d->lastMousePosition = QPoint(); - if (d->mouseGrabberItem) - d->mouseGrabberItem->ungrabMouse(); break; #ifndef QT_NO_DRAGANDDROP case QEvent::DragEnter: @@ -1174,6 +1172,8 @@ bool QQuickWindow::event(QEvent *e) if (d->activeFocusItem) qGuiApp->inputMethod()->commit(); #endif + if (d->mouseGrabberItem) + d->mouseGrabberItem->ungrabMouse(); break; default: break; diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp index fb75a7669e..4e3748f78f 100644 --- a/src/quick/util/qquickimageprovider.cpp +++ b/src/quick/util/qquickimageprovider.cpp @@ -52,7 +52,7 @@ public: /*! \class QQuickTextureFactory - \since 5.0 + \since QtQuick 2.0 \brief The QQuickTextureFactory class provides an interface for loading custom textures from QML. \inmodule QtQuick @@ -127,7 +127,7 @@ QImage QQuickTextureFactory::image() const /*! \class QQuickImageProvider - \since 5.0 + \since QtQuick 2.0 \inmodule QtQuick \brief The QQuickImageProvider class provides an interface for supporting pixmaps and threaded image requests in QML. diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index e43c5e9b71..dda2fbe2b0 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -565,6 +565,8 @@ void QQuickPixmapReader::processJob(QQuickPixmapReply *runningJob, const QUrl &u mutex.lock(); if (!cancelled.contains(runningJob)) runningJob->postReply(errorCode, errorStr, readSize, t); + else + delete t; mutex.unlock(); } diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_pixel.qml b/tests/auto/quick/qquickcanvasitem/data/tst_pixel.qml index 469ff2398d..487f7dc903 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_pixel.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_pixel.qml @@ -1,4 +1,5 @@ import QtQuick 2.0 +import QtTest 1.0 CanvasTestCase { id:testCase @@ -7,6 +8,13 @@ CanvasTestCase { function test_createImageData(row) { var canvas = createCanvasObject(row); var ctx = canvas.getContext('2d'); + var imageData = ctx.createImageData(1, 1); + var imageDataValues = imageData.data; + imageDataValues[0] = 255; + imageDataValues[0] = 0; + if (imageDataValues[0] != 0) + qtest_fail('ImageData value access fail, expecting 0, got ' + imageDataValues[0]); + ctx.reset(); canvas.destroy() } diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index 5226434c14..9645aaaab3 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -999,7 +999,7 @@ void tst_qquickflickable::pressWhileFlicking() // flicking == false, moving == true; flick(window.data(), QPoint(20,190), QPoint(20, 50), 200); QVERIFY(flickable->verticalVelocity() > 0.0); - QVERIFY(flickable->isFlicking()); + QTRY_VERIFY(flickable->isFlicking()); QVERIFY(flickable->isFlickingVertically()); QVERIFY(!flickable->isFlickingHorizontally()); QVERIFY(flickable->isMoving()); @@ -1254,7 +1254,7 @@ void tst_qquickflickable::flickTwiceUsingTouches() window->setSource(testFileUrl("longList.qml")); window->show(); window->requestActivate(); - QTest::qWaitForWindowActive(window); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(window->rootObject() != 0); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); diff --git a/tests/auto/quick/qquickimage/data/correctStatus.qml b/tests/auto/quick/qquickimage/data/correctStatus.qml new file mode 100644 index 0000000000..2326078657 --- /dev/null +++ b/tests/auto/quick/qquickimage/data/correctStatus.qml @@ -0,0 +1,26 @@ +import QtQuick 2.0 + +Item { + property alias status: image1.status + + Image { + id: image1 + asynchronous: true + source: "image://test/first-image.png" + } + + Image { + id: image2 + asynchronous: true + source: "image://test/first-image.png" + } + + Timer { + interval: 50 + running: true + repeat: false + onTriggered: { + image1.source = "image://test/second-image.png" + } + } +} diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp index 7f3f0d5cbc..51ac5c640a 100644 --- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp +++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp @@ -56,6 +56,7 @@ #include <QtGui/QPainter> #include <QtGui/QImageReader> #include <QQuickWindow> +#include <QQuickImageProvider> #include "../../shared/util.h" #include "../../shared/testhttpserver.h" @@ -102,6 +103,7 @@ private slots: void sourceSize(); void progressAndStatusChanges(); void sourceSizeChanges(); + void correctStatus(); private: QQmlEngine engine; @@ -868,6 +870,55 @@ void tst_qquickimage::progressAndStatusChanges() delete obj; } +class TestQImageProvider : public QQuickImageProvider +{ +public: + TestQImageProvider() : QQuickImageProvider(Image) {} + + QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize) + { + if (id == QLatin1String("first-image.png")) { + QTest::qWait(50); + int width = 100; + int height = 100; + QImage image(width, height, QImage::Format_RGB32); + image.fill(QColor("yellow").rgb()); + if (size) + *size = QSize(width, height); + return image; + } + + QTest::qWait(400); + int width = 100; + int height = 100; + QImage image(width, height, QImage::Format_RGB32); + image.fill(QColor("green").rgb()); + if (size) + *size = QSize(width, height); + return image; + } +}; + +void tst_qquickimage::correctStatus() +{ + QQmlEngine engine; + engine.addImageProvider(QLatin1String("test"), new TestQImageProvider()); + + QQmlComponent component(&engine, testFileUrl("correctStatus.qml")); + QObject *obj = component.create(); + QVERIFY(obj); + + QTest::qWait(200); + + // at this point image1 should be attempting to load second-image.png, + // and should be in the loading state. Without a clear prior to that load, + // the status can mistakenly be in the ready state. + QCOMPARE(obj->property("status").toInt(), int(QQuickImage::Loading)); + + QTest::qWait(400); + delete obj; +} + QTEST_MAIN(tst_qquickimage) #include "tst_qquickimage.moc" diff --git a/tests/auto/quick/qquickmousearea/qquickmousearea.pro b/tests/auto/quick/qquickmousearea/qquickmousearea.pro index 957b04a558..dd7b434898 100644 --- a/tests/auto/quick/qquickmousearea/qquickmousearea.pro +++ b/tests/auto/quick/qquickmousearea/qquickmousearea.pro @@ -10,7 +10,5 @@ include (../../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test - QT += core-private gui-private qml-private quick-private network testlib DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp index 9fd42373e2..ffe7b51537 100644 --- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp @@ -248,7 +248,7 @@ void tst_QQuickMouseArea::dragging() window->setSource(testFileUrl("dragging.qml")); window->show(); window->requestActivate(); - QTest::qWait(20); + QVERIFY(QTest::qWaitForWindowExposed(window)); QVERIFY(window->rootObject() != 0); QQuickMouseArea *mouseRegion = window->rootObject()->findChild<QQuickMouseArea*>("mouseregion"); @@ -274,19 +274,17 @@ void tst_QQuickMouseArea::dragging() // First move event triggers drag, second is acted upon. // This is due to possibility of higher stacked area taking precedence. - QTest::mouseMove(window, QPoint(111,111)); - QTest::qWait(50); - QTest::mouseMove(window, QPoint(122,122)); - QTest::qWait(50); + QTest::mouseMove(window, QPoint(111,111), 50); + QTest::mouseMove(window, QPoint(116,116), 50); + QTest::mouseMove(window, QPoint(122,122), 50); - QVERIFY(drag->active()); - QCOMPARE(blackRect->x(), 72.0); + QTRY_VERIFY(drag->active()); + QTRY_COMPARE(blackRect->x(), 72.0); QCOMPARE(blackRect->y(), 72.0); QTest::mouseRelease(window, button, 0, QPoint(122,122)); - QTest::qWait(50); - QVERIFY(!drag->active()); + QTRY_VERIFY(!drag->active()); QCOMPARE(blackRect->x(), 72.0); QCOMPARE(blackRect->y(), 72.0); @@ -477,20 +475,28 @@ void tst_QQuickMouseArea::noOnClickedWithPressAndHold() window->show(); window->requestActivate(); QVERIFY(window->rootObject() != 0); + QQuickMouseArea *mouseArea = qobject_cast<QQuickMouseArea*>(window->rootObject()->children().first()); + QVERIFY(mouseArea); QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); QGuiApplication::sendEvent(window, &pressEvent); + QVERIFY(mouseArea->pressedButtons() == Qt::LeftButton); QVERIFY(!window->rootObject()->property("clicked").toBool()); QVERIFY(!window->rootObject()->property("held").toBool()); + // timeout is 800 (in qquickmousearea.cpp) QTest::qWait(1000); + QCoreApplication::processEvents(); + + QVERIFY(!window->rootObject()->property("clicked").toBool()); + QVERIFY(window->rootObject()->property("held").toBool()); QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); QGuiApplication::sendEvent(window, &releaseEvent); + QTRY_VERIFY(window->rootObject()->property("held").toBool()); QVERIFY(!window->rootObject()->property("clicked").toBool()); - QVERIFY(window->rootObject()->property("held").toBool()); delete window; } diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index 2714ce47f6..8e63b6207f 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -3089,6 +3089,14 @@ void tst_qquicktextinput::cursorRectangle() input.setHAlign(leftToRight ? QQuickTextInput::AlignRight : QQuickTextInput::AlignLeft); r = input.cursorRectangle(); QCOMPARE(r.left(), leftToRight ? input.width() : 0); + + QSignalSpy cursorRectangleSpy(&input, SIGNAL(cursorRectangleChanged())); + + QString widerText = shortText; + widerText[1] = 'W'; // Assumes shortText is at least two characters long. + input.setText(widerText); + + QCOMPARE(cursorRectangleSpy.count(), 1); } void tst_qquicktextinput::readOnly() diff --git a/tests/auto/quick/qquickview/tst_qquickview.cpp b/tests/auto/quick/qquickview/tst_qquickview.cpp index 64b108cbec..e2e20a6516 100644 --- a/tests/auto/quick/qquickview/tst_qquickview.cpp +++ b/tests/auto/quick/qquickview/tst_qquickview.cpp @@ -153,8 +153,7 @@ void tst_QQuickView::resizemodeitem() // size update from view view->resize(QSize(200,300)); - QTest::qWait(50); - QCOMPARE(item->width(), 200.0); + QTRY_COMPARE(item->width(), 200.0); QCOMPARE(item->height(), 300.0); QCOMPARE(view->size(), QSize(200, 300)); QCOMPARE(view->size(), view->sizeHint()); diff --git a/tests/manual/scenegraph_lancelot/data/text/text_html_center_tag.qml b/tests/manual/scenegraph_lancelot/data/text/text_html_center_tag.qml new file mode 100644 index 0000000000..86b528f0a4 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/text/text_html_center_tag.qml @@ -0,0 +1,35 @@ +import QtQuick 2.0 + +Item { + width: 320 + height: 480 + + Text { + id: implicitSizedText + textFormat: Text.RichText + text: "<center>Implicit size<br>----- Second line -----</center>" + anchors.centerIn: parent + color: "white" + + Rectangle { + anchors.fill: parent + z: -1 + color: "blue" + } + } + Text { + textFormat: Text.RichText + text: "<center>Explicit size<br>----- Second line -----</center>" + anchors.top: implicitSizedText.bottom + anchors.topMargin: 10 + anchors.horizontalCenter: parent.horizontalCenter + width: 300 + color: "white" + + Rectangle { + anchors.fill: parent + z: -1 + color: "blue" + } + } +} |