diff options
author | Liang Qi <liang.qi@qt.io> | 2016-05-19 06:34:04 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-05-19 06:34:04 +0200 |
commit | afc84775efdc6e13e2e210bb94e115b378d90134 (patch) | |
tree | 24985cc95111ecf2b637019363a32414b95860fe | |
parent | 6371b208a9e55845090dcd34234e314c6587c105 (diff) | |
parent | 72515ebe5a63c201fde09471bc646dbe15110a6b (diff) |
Merge remote-tracking branch 'origin/5.6.1' into 5.6
Change-Id: Ib7f8c60143c1efab279476dba390a3d9837ccc37
44 files changed, 240 insertions, 97 deletions
diff --git a/dist/changes-5.6.1 b/dist/changes-5.6.1 new file mode 100644 index 0000000000..5a3c9b62e6 --- /dev/null +++ b/dist/changes-5.6.1 @@ -0,0 +1,53 @@ +Qt 5.6.1 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.6.0. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + + http://qt-project.org/doc/qt-5.6 + +The Qt version 5.6 series is binary compatible with the 5.5.x series. +Applications compiled for 5.5 will continue to run with 5.6. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + + http://bugreports.qt-project.org/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Important Behavior Changes * +**************************************************************************** + +* [QTBUG-51746] When matching the method signature of a invokable method to + the slot in the metaobject, the matching function now assigns the best + match to a QJSValue if the parameter actually is a QJSValue. This corrects + the previous behavior, where QJSValue and int were given the same match + score even though QJSValue would have been the best match. +* [QTBUG-50604] Assigning NaN to an Item's x or y previously had the side effect + of making the item invisible (as well as warning about a bad + QTransform::translate call). Setting NaN will now be ignored (as it already + was for width and height), and no longer have any visual effect. +* [QTBUG-51231] TextInput with a non-Normal echoMode can now no longer cut or + copy text. + +**************************************************************************** +* Library * +**************************************************************************** + +QtQuick +----------------- + + - QQuickPaintedItem: When the device pixel ratio is changed for the screen the item is rendered + on then the item will be updated. + - [QTBUG-50085] Canvas: Fix crash when item has a negative width or height. + - [QTBUG-48870] GridView: Don't get "holes" in the grid if model updates occur + frequently. + +QtQml +----- + + - [QTBUG-52065] Fix crash with Array.unshift() + diff --git a/examples/qml/qml.pro b/examples/qml/qml.pro index d5f9fa8a9e..eb4c98e5c4 100644 --- a/examples/qml/qml.pro +++ b/examples/qml/qml.pro @@ -7,6 +7,7 @@ qtHaveModule(quick): SUBDIRS += \ SUBDIRS += \ referenceexamples \ + tutorials \ shell EXAMPLE_FILES = \ diff --git a/examples/qml/qmlextensionplugins/qmlextensionplugins.pro b/examples/qml/qmlextensionplugins/qmlextensionplugins.pro index 64fd23af8d..946626cce7 100644 --- a/examples/qml/qmlextensionplugins/qmlextensionplugins.pro +++ b/examples/qml/qmlextensionplugins/qmlextensionplugins.pro @@ -21,3 +21,5 @@ target.path += $$[QT_INSTALL_EXAMPLES]/qml/qmlextensionplugins/imports/TimeExamp pluginfiles.path += $$[QT_INSTALL_EXAMPLES]/qml/qmlextensionplugins/imports/TimeExample INSTALLS += target qml pluginfiles + +CONFIG += install_ok # Do not cargo-cult this! diff --git a/examples/qml/tutorials/extending-qml/chapter3-bindings/chapter3-bindings.pro b/examples/qml/tutorials/extending-qml/chapter3-bindings/chapter3-bindings.pro index 0c31592eeb..1ae83f71eb 100644 --- a/examples/qml/tutorials/extending-qml/chapter3-bindings/chapter3-bindings.pro +++ b/examples/qml/tutorials/extending-qml/chapter3-bindings/chapter3-bindings.pro @@ -4,9 +4,9 @@ HEADERS += piechart.h SOURCES += piechart.cpp \ main.cpp -RESOURCES += chapter3-binding.qrc +RESOURCES += chapter3-bindings.qrc -DESTPATH = $$[QT_INSTALL_EXAMPLES]/qml/tutorials/extending-qml/chapter3-binding +DESTPATH = $$[QT_INSTALL_EXAMPLES]/qml/tutorials/extending-qml/chapter3-bindings target.path = $$DESTPATH qml.files = *.qml diff --git a/examples/qml/tutorials/extending-qml/chapter3-bindings/chapter3-binding.qrc b/examples/qml/tutorials/extending-qml/chapter3-bindings/chapter3-bindings.qrc index f1168aef3b..f1168aef3b 100644 --- a/examples/qml/tutorials/extending-qml/chapter3-bindings/chapter3-binding.qrc +++ b/examples/qml/tutorials/extending-qml/chapter3-bindings/chapter3-bindings.qrc diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/app.pro b/examples/qml/tutorials/extending-qml/chapter6-plugins/app.pro index 4d0e807417..b340981e42 100644 --- a/examples/qml/tutorials/extending-qml/chapter6-plugins/app.pro +++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/app.pro @@ -13,3 +13,6 @@ osx { SOURCES += main.cpp RESOURCES += app.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/qml/tutorials/extending-qml/chapter6-plugins +INSTALLS += target diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/import.pro b/examples/qml/tutorials/extending-qml/chapter6-plugins/import/import.pro index cefcf3b477..5cf4621420 100644 --- a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/import.pro +++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/import/import.pro @@ -20,7 +20,11 @@ qmldir.files=$$PWD/qmldir qmldir.path=$$DESTPATH INSTALLS += target qmldir +CONFIG += install_ok # Do not cargo-cult this! + OTHER_FILES += qmldir # Copy the qmldir file to the same folder as the plugin binary -QMAKE_POST_LINK += $$QMAKE_COPY $$replace($$list($$quote($$PWD/qmldir) $$DESTDIR), /, $$QMAKE_DIR_SEP) +cpqmldir.files = qmldir +cpqmldir.path = $$DESTDIR +COPIES += cpqmldir diff --git a/examples/qml/tutorials/tutorials.pro b/examples/qml/tutorials/tutorials.pro new file mode 100644 index 0000000000..265b3b69cc --- /dev/null +++ b/examples/qml/tutorials/tutorials.pro @@ -0,0 +1,3 @@ +TEMPLATE = subdirs +qtHaveModule(quick): SUBDIRS += \ + extending-qml diff --git a/examples/quick/customitems/painteditem/painteditem.pro b/examples/quick/customitems/painteditem/painteditem.pro index 3ec6420abf..bc7480ab9e 100644 --- a/examples/quick/customitems/painteditem/painteditem.pro +++ b/examples/quick/customitems/painteditem/painteditem.pro @@ -19,5 +19,7 @@ qmldir.path = $$[QT_INSTALL_EXAMPLES]/quick/customitems/painteditem/TextBalloonP INSTALLS += qmldir target +CONFIG += install_ok # Do not cargo-cult this! + OTHER_FILES += \ textballoons.qml diff --git a/examples/quick/imageprovider/imageprovider.pro b/examples/quick/imageprovider/imageprovider.pro index 5567a2d6d9..e54469b0d8 100644 --- a/examples/quick/imageprovider/imageprovider.pro +++ b/examples/quick/imageprovider/imageprovider.pro @@ -13,3 +13,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/quick/imageprovider/ImageProviderCore qml.files = ImageProviderCore/qmldir qml.path = $$[QT_INSTALL_EXAMPLES]/quick/imageprovider/ImageProviderCore INSTALLS = target qml + +CONFIG += install_ok # Do not cargo-cult this! diff --git a/examples/quick/imageresponseprovider/imageresponseprovider.pro b/examples/quick/imageresponseprovider/imageresponseprovider.pro index 856ddde863..8be4dbb658 100644 --- a/examples/quick/imageresponseprovider/imageresponseprovider.pro +++ b/examples/quick/imageresponseprovider/imageresponseprovider.pro @@ -13,3 +13,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/quick/imageresponseprovider/ImageResponseP qml.files = ImageResponseProviderCore/qmldir qml.path = $$[QT_INSTALL_EXAMPLES]/quick/imageresponseprovider/ImageResponseProviderCore INSTALLS = target qml + +CONFIG += install_ok # Do not cargo-cult this! diff --git a/examples/quick/quick-accessibility/quick-accessibility.pro b/examples/quick/quick-accessibility/quick-accessibility.pro index 70cf34b54c..cc9d48ac0f 100644 --- a/examples/quick/quick-accessibility/quick-accessibility.pro +++ b/examples/quick/quick-accessibility/quick-accessibility.pro @@ -6,3 +6,6 @@ RESOURCES += accessibility.qrc target.path = $$[QT_INSTALL_EXAMPLES]/quick/quick-accessibility INSTALLS += target + +EXAMPLE_FILES += \ + accessibility.qmlproject diff --git a/examples/quick/quick.pro b/examples/quick/quick.pro index c5ef46173c..e60150c13b 100644 --- a/examples/quick/quick.pro +++ b/examples/quick/quick.pro @@ -15,6 +15,7 @@ SUBDIRS = quick-accessibility \ scenegraph \ shadereffects \ text \ + textureprovider \ threading \ touchinteraction \ tutorials \ diff --git a/examples/quick/quickwidgets/qquickviewcomparison/qquickviewcomparison.pro b/examples/quick/quickwidgets/qquickviewcomparison/qquickviewcomparison.pro index 9d70f7aa5a..80216da346 100644 --- a/examples/quick/quickwidgets/qquickviewcomparison/qquickviewcomparison.pro +++ b/examples/quick/quickwidgets/qquickviewcomparison/qquickviewcomparison.pro @@ -15,3 +15,6 @@ HEADERS += mainwindow.h \ RESOURCES += qquickviewcomparison.qrc OTHER_FILES += test.qml + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/quickwidgets/qquickviewcomparison +INSTALLS += target diff --git a/examples/quick/quickwidgets/quickwidget/quickwidget.pro b/examples/quick/quickwidgets/quickwidget/quickwidget.pro index 1aca22082e..04fb5541a7 100644 --- a/examples/quick/quickwidgets/quickwidget/quickwidget.pro +++ b/examples/quick/quickwidgets/quickwidget/quickwidget.pro @@ -6,3 +6,6 @@ TEMPLATE = app SOURCES += main.cpp RESOURCES += quickwidget.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/quickwidgets/quickwidget +INSTALLS += target diff --git a/examples/quick/scenegraph/graph/graph.pro b/examples/quick/scenegraph/graph/graph.pro index dd77d76e4f..1a880b61f1 100644 --- a/examples/quick/scenegraph/graph/graph.pro +++ b/examples/quick/scenegraph/graph/graph.pro @@ -26,3 +26,5 @@ OTHER_FILES += \ shaders/line.fsh \ shaders/line.vsh +target.path = $$[QT_INSTALL_EXAMPLES]/quick/scenegraph/graph +INSTALLS += target diff --git a/examples/quick/scenegraph/scenegraph.pro b/examples/quick/scenegraph/scenegraph.pro index 1e7e74372d..cf50cdb903 100644 --- a/examples/quick/scenegraph/scenegraph.pro +++ b/examples/quick/scenegraph/scenegraph.pro @@ -1,6 +1,7 @@ TEMPLATE = subdirs SUBDIRS += \ customgeometry \ + graph \ openglunderqml \ sgengine \ simplematerial \ @@ -8,3 +9,6 @@ SUBDIRS += \ textureinthread \ threadedanimation \ twotextureproviders + +EXAMPLE_FILES += \ + shared diff --git a/examples/quick/tutorials/gettingStartedQml/filedialog/filedialog.pro b/examples/quick/tutorials/gettingStartedQml/filedialog/filedialog.pro index e88e8f670c..8f8f4549aa 100644 --- a/examples/quick/tutorials/gettingStartedQml/filedialog/filedialog.pro +++ b/examples/quick/tutorials/gettingStartedQml/filedialog/filedialog.pro @@ -18,8 +18,11 @@ SOURCES += \ file.cpp \ dialogPlugin.cpp -OTHER_FILES += qmldir +EXAMPLE_FILES += qmldir # Copy the qmldir file to the same folder as the plugin binary -QMAKE_POST_LINK += $$QMAKE_COPY $$shell_quote($$shell_path($$PWD/qmldir)) \ - $$shell_quote($$shell_path($$DESTDIR)) $$escape_expand(\\n\\t) +cpqmldir.files = $$PWD/qmldir +cpqmldir.path = $$DESTDIR +COPIES += cpqmldir + +CONFIG += install_ok # Do not cargo-cult this! diff --git a/examples/quick/tutorials/gettingStartedQml/gettingStartedQml.pro b/examples/quick/tutorials/gettingStartedQml/gettingStartedQml.pro index 1fc74b69f3..725ff3bbac 100644 --- a/examples/quick/tutorials/gettingStartedQml/gettingStartedQml.pro +++ b/examples/quick/tutorials/gettingStartedQml/gettingStartedQml.pro @@ -7,4 +7,5 @@ EXAMPLE_FILES = \ images \ parts \ pics \ + texteditor.qmlproject \ texteditor.qml diff --git a/examples/quick/window/window.pro b/examples/quick/window/window.pro index be35b24325..c3e9b080bb 100644 --- a/examples/quick/window/window.pro +++ b/examples/quick/window/window.pro @@ -6,7 +6,8 @@ RESOURCES += \ window.qrc \ ../shared/shared.qrc EXAMPLE_FILES = \ - window.qml + window.qml \ + resources target.path = $$[QT_INSTALL_EXAMPLES]/quick/window INSTALLS += target diff --git a/src/imports/builtins/builtins.pro b/src/imports/builtins/builtins.pro new file mode 100644 index 0000000000..112555b6de --- /dev/null +++ b/src/imports/builtins/builtins.pro @@ -0,0 +1,19 @@ +TEMPLATE = aux + +QMLTYPEFILE = builtins.qmltypes + +# install rule +builtins.files = $$QMLTYPEFILE +builtins.path = $$[QT_INSTALL_QML] +INSTALLS += builtins + +# copy to build directory +!prefix_build: COPIES += builtins + +# qmltypes target +!cross_compile:if(build_pass|!debug_and_release) { + qtPrepareTool(QMLPLUGINDUMP, qmlplugindump) + + qmltypes.commands = $$QMLPLUGINDUMP -builtins > $$PWD/$$QMLTYPEFILE + QMAKE_EXTRA_TARGETS += qmltypes +} diff --git a/src/imports/builtins.qmltypes b/src/imports/builtins/builtins.qmltypes index cca1c20d54..cca1c20d54 100644 --- a/src/imports/builtins.qmltypes +++ b/src/imports/builtins/builtins.qmltypes diff --git a/src/imports/imports.pro b/src/imports/imports.pro index f7002f9ed5..a63ca0af41 100644 --- a/src/imports/imports.pro +++ b/src/imports/imports.pro @@ -1,6 +1,7 @@ TEMPLATE = subdirs SUBDIRS += \ + builtins \ qtqml \ folderlistmodel \ localstorage \ @@ -17,35 +18,3 @@ qtHaveModule(quick) { } qtHaveModule(xmlpatterns) : SUBDIRS += xmllistmodel - - -QMLTYPEFILE = builtins.qmltypes - -# install rule -builtins.files = $$QMLTYPEFILE -builtins.path = $$[QT_INSTALL_QML] -INSTALLS += builtins - -# copy to build directory -!force_independent:if(!debug_and_release|!build_all|CONFIG(release, debug|release)) { - defineReplace(qmlModStripSrcDir) { - return($$relative_path($$1, $$_PRO_FILE_PWD_)) - } - - qmltypes2build.input = QMLTYPEFILE - qmltypes2build.output = $$[QT_INSTALL_QML]/${QMAKE_FUNC_FILE_IN_qmlModStripSrcDir} - !contains(TEMPLATE, vc.*): qmltypes2build.variable_out = PRE_TARGETDEPS - qmltypes2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} - qmltypes2build.name = COPY ${QMAKE_FILE_IN} - qmltypes2build.CONFIG = no_link no_clean - - QMAKE_EXTRA_COMPILERS += qmltypes2build -} - -# qmltypes target -!cross_compile:if(build_pass|!debug_and_release) { - qtPrepareTool(QMLPLUGINDUMP, qmlplugindump) - - qmltypes.commands = $$QMLPLUGINDUMP -builtins > $$PWD/$$QMLTYPEFILE - QMAKE_EXTRA_TARGETS += qmltypes -} diff --git a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp index 69d36beaca..2e895778f0 100644 --- a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp +++ b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp @@ -75,8 +75,6 @@ QT_BEGIN_NAMESPACE */ Q_QML_DEBUG_PLUGIN_LOADER(QQmlDebugServerConnection) -Q_QML_IMPORT_DEBUG_PLUGIN(QTcpServerConnectionFactory) -Q_QML_IMPORT_DEBUG_PLUGIN(QLocalClientConnectionFactory) const int protocolVersion = 1; diff --git a/src/qml/debugger/qqmldebugconnector.cpp b/src/qml/debugger/qqmldebugconnector.cpp index 64a8a49bb9..33bed958b5 100644 --- a/src/qml/debugger/qqmldebugconnector.cpp +++ b/src/qml/debugger/qqmldebugconnector.cpp @@ -47,14 +47,9 @@ QT_BEGIN_NAMESPACE // Connectors. We could add more plugins here, and distinguish by arguments to instance() Q_QML_DEBUG_PLUGIN_LOADER(QQmlDebugConnector) -Q_QML_IMPORT_DEBUG_PLUGIN(QQmlDebugServerFactory) -Q_QML_IMPORT_DEBUG_PLUGIN(QQmlNativeDebugConnectorFactory) // Services Q_QML_DEBUG_PLUGIN_LOADER(QQmlDebugService) -Q_QML_IMPORT_DEBUG_PLUGIN(QQmlInspectorServiceFactory) -Q_QML_IMPORT_DEBUG_PLUGIN(QQmlProfilerServiceFactory) -Q_QML_IMPORT_DEBUG_PLUGIN(QQmlDebuggerServiceFactory) struct QQmlDebugConnectorParams { QString pluginKey; diff --git a/src/qml/debugger/qqmldebugpluginmanager_p.h b/src/qml/debugger/qqmldebugpluginmanager_p.h index 6fffa67d7b..a5f5157793 100644 --- a/src/qml/debugger/qqmldebugpluginmanager_p.h +++ b/src/qml/debugger/qqmldebugpluginmanager_p.h @@ -68,15 +68,6 @@ QT_BEGIN_NAMESPACE #else // QT_NO_QML_DEBUGGER -#ifdef QT_STATIC -#define Q_QML_IMPORT_DEBUG_PLUGIN(className)\ - QT_END_NAMESPACE\ - Q_IMPORT_PLUGIN(className)\ - QT_BEGIN_NAMESPACE -#else -#define Q_QML_IMPORT_DEBUG_PLUGIN(className) -#endif // QT_STATIC - #define Q_QML_DEBUG_PLUGIN_LOADER(interfaceName)\ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, interfaceName##Loader,\ (interfaceName##Factory_iid, QLatin1String("/qmltooling")))\ diff --git a/src/qml/doc/qtqml.qdocconf b/src/qml/doc/qtqml.qdocconf index 500754ead4..74b61fd6e1 100644 --- a/src/qml/doc/qtqml.qdocconf +++ b/src/qml/doc/qtqml.qdocconf @@ -4,7 +4,7 @@ project = QtQml description = Qt QML Reference Documentation version = $QT_VERSION -examplesinstallpath = qtdeclarative/qml +examplesinstallpath = qml qhp.projects = QtQml diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h index 6c360e7dda..c0c89a5c3d 100644 --- a/src/qml/jsruntime/qv4context_p.h +++ b/src/qml/jsruntime/qv4context_p.h @@ -241,7 +241,7 @@ struct WithContext : public ExecutionContext V4_MANAGED(WithContext, ExecutionContext) }; -struct QmlContext : public ExecutionContext +struct Q_QML_EXPORT QmlContext : public ExecutionContext { V4_MANAGED(QmlContext, ExecutionContext) diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 49b6dce697..fefc5b6308 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -693,7 +693,7 @@ Heap::QmlContext *ExecutionEngine::qmlContext() const if (ctx->type == Heap::ExecutionContext::Type_SimpleCallContext && !ctx->outer) ctx = parentContext(currentContext)->d(); - if (!ctx->outer) + if (ctx->type != Heap::ExecutionContext::Type_QmlContext && !ctx->outer) return 0; while (ctx->outer && ctx->outer->type != Heap::ExecutionContext::Type_GlobalContext) diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 9b52a951af..24abf52e38 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -1071,6 +1071,7 @@ struct QmlIncubatorObject : Object { QPointer<QObject> parent; QV4::Value valuemap; QV4::Value statusChanged; + Pointer<Heap::QmlContext> qmlContext; }; } @@ -1185,7 +1186,7 @@ static void QQmlComponent_setQmlParent(QObject *me, QObject *parent) */ -static void setInitialProperties(QV4::ExecutionEngine *engine, const QV4::Value &o, const QV4::Value &v) +static void setInitialProperties(QV4::ExecutionEngine *engine, QV4::QmlContext *qmlContext, const QV4::Value &o, const QV4::Value &v) { QV4::Scope scope(engine); QV4::ScopedObject object(scope); @@ -1196,6 +1197,9 @@ static void setInitialProperties(QV4::ExecutionEngine *engine, const QV4::Value if (engine->hasException) return; + QV4::ExecutionContextSaver saver(scope); + engine->pushContext(qmlContext); + while (1) { name = it.nextPropertyNameAsString(val); if (!name) @@ -1269,8 +1273,10 @@ void QQmlComponent::createObject(QQmlV4Function *args) QV4::ScopedValue object(scope, QV4::QObjectWrapper::wrap(v4, rv)); Q_ASSERT(object->isObject()); - if (!valuemap->isUndefined()) - setInitialProperties(v4, object, valuemap); + if (!valuemap->isUndefined()) { + QV4::Scoped<QV4::QmlContext> qmlContext(scope, v4->qmlContext()); + setInitialProperties(v4, qmlContext, object, valuemap); + } d->completeCreate(); @@ -1387,6 +1393,7 @@ void QQmlComponent::incubateObject(QQmlV4Function *args) if (!valuemap->isUndefined()) r->d()->valuemap = valuemap; + r->d()->qmlContext = v4->qmlContext(); r->d()->parent = parent; QQmlIncubator *incubator = r->d()->incubator.data(); @@ -1400,7 +1407,7 @@ void QQmlComponent::incubateObject(QQmlV4Function *args) } // XXX used by QSGLoader -void QQmlComponentPrivate::initializeObjectWithInitialProperties(const QV4::Value &valuemap, QObject *toCreate) +void QQmlComponentPrivate::initializeObjectWithInitialProperties(QV4::QmlContext *qmlContext, const QV4::Value &valuemap, QObject *toCreate) { QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine); QV4::ExecutionEngine *v4engine = QV8Engine::getV4(ep->v8engine()); @@ -1410,7 +1417,7 @@ void QQmlComponentPrivate::initializeObjectWithInitialProperties(const QV4::Valu Q_ASSERT(object->as<QV4::Object>()); if (!valuemap.isUndefined()) - setInitialProperties(v4engine, object, valuemap); + setInitialProperties(v4engine, qmlContext, object, valuemap); } QQmlComponentExtension::QQmlComponentExtension(QV4::ExecutionEngine *v4) @@ -1487,6 +1494,7 @@ QQmlComponentExtension::~QQmlComponentExtension() QV4::Heap::QmlIncubatorObject::QmlIncubatorObject(QQmlIncubator::IncubationMode m) : valuemap(QV4::Primitive::undefinedValue()) , statusChanged(QV4::Primitive::undefinedValue()) + , qmlContext(0) { incubator.reset(new QQmlComponentIncubator(this, m)); } @@ -1499,7 +1507,8 @@ void QV4::QmlIncubatorObject::setInitialState(QObject *o) QV4::ExecutionEngine *v4 = engine(); QV4::Scope scope(v4); QV4::ScopedObject obj(scope, QV4::QObjectWrapper::wrap(v4, o)); - setInitialProperties(v4, obj, d()->valuemap); + QV4::Scoped<QV4::QmlContext> qmlCtxt(scope, d()->qmlContext); + setInitialProperties(v4, qmlCtxt, obj, d()->valuemap); } } @@ -1508,6 +1517,8 @@ void QV4::QmlIncubatorObject::markObjects(QV4::Heap::Base *that, QV4::ExecutionE QmlIncubatorObject::Data *o = static_cast<QmlIncubatorObject::Data *>(that); o->valuemap.mark(e); o->statusChanged.mark(e); + if (o->qmlContext) + o->qmlContext->mark(e); Object::markObjects(that, e); } diff --git a/src/qml/qml/qqmlcomponent_p.h b/src/qml/qml/qqmlcomponent_p.h index 15ec88dd52..ff6969fcdc 100644 --- a/src/qml/qml/qqmlcomponent_p.h +++ b/src/qml/qml/qqmlcomponent_p.h @@ -82,7 +82,7 @@ public: QObject *beginCreate(QQmlContextData *); void completeCreate(); - void initializeObjectWithInitialProperties(const QV4::Value &valuemap, QObject *toCreate); + void initializeObjectWithInitialProperties(QV4::QmlContext *qmlContext, const QV4::Value &valuemap, QObject *toCreate); QQmlTypeData *typeData; virtual void typeDataReady(QQmlTypeData *); diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index 9fc01c8e35..c4e0c7b778 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -850,7 +850,7 @@ bool QQmlImportsPrivate::populatePluginPairVector(QVector<StaticPluginPair> &res // To avoid traversing all static plugins for all imports, we cut down // the list the first time called to only contain QML plugins: foreach (const QStaticPlugin &plugin, QPluginLoader::staticPlugins()) { - if (plugin.metaData().value(QStringLiteral("IID")).toString() == QLatin1String(QQmlExtensionInterface_iid)) + if (qobject_cast<QQmlExtensionPlugin *>(plugin.instance())) plugins.append(plugin); } } diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 0e0efcf753..c684c8602e 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -958,7 +958,7 @@ struct CachedLoader { } void loadAsync(QQmlTypeLoader *loader, QQmlDataBlob *blob) const { - loader->m_thread->loadWithCachedUnit(blob, unit); + loader->m_thread->loadWithCachedUnitAsync(blob, unit); } }; diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf index 63ada10fce..14a70b3421 100644 --- a/src/quick/doc/qtquick.qdocconf +++ b/src/quick/doc/qtquick.qdocconf @@ -4,7 +4,7 @@ project = QtQuick description = Qt Quick Reference Documentation version = $QT_VERSION -examplesinstallpath = qtdeclarative/quick +examplesinstallpath = quick qhp.projects = QtQuick diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp index 456eedd0be..7cac79bd46 100644 --- a/src/quick/items/qquickloader.cpp +++ b/src/quick/items/qquickloader.cpp @@ -577,6 +577,7 @@ void QQuickLoader::setSource(QQmlV4Function *args) d->disposeInitialPropertyValues(); d->initialPropertyValues.set(args->v4engine(), ipv); } + d->qmlCallingContext.set(scope.engine, scope.engine->qmlContext()); setSource(sourceUrl, false); // already cleared and set ipv above. } @@ -645,7 +646,8 @@ void QQuickLoaderPrivate::setInitialState(QObject *obj) Q_ASSERT(v4); QV4::Scope scope(v4); QV4::ScopedValue ipv(scope, initialPropertyValues.value()); - d->initializeObjectWithInitialProperties(ipv, obj); + QV4::Scoped<QV4::QmlContext> qmlContext(scope, qmlCallingContext.value()); + d->initializeObjectWithInitialProperties(qmlContext, ipv, obj); } void QQuickLoaderIncubator::statusChanged(Status status) diff --git a/src/quick/items/qquickloader_p_p.h b/src/quick/items/qquickloader_p_p.h index 9677318b58..26a74be9d9 100644 --- a/src/quick/items/qquickloader_p_p.h +++ b/src/quick/items/qquickloader_p_p.h @@ -102,6 +102,7 @@ public: QQmlContext *itemContext; QQuickLoaderIncubator *incubator; QV4::PersistentValue initialPropertyValues; + QV4::PersistentValue qmlCallingContext; bool updatingSize: 1; bool active : 1; bool loadingFromSource : 1; diff --git a/tests/auto/qml/qqmlcomponent/data/callingQmlContext.qml b/tests/auto/qml/qqmlcomponent/data/callingQmlContext.qml new file mode 100644 index 0000000000..8193d0f36c --- /dev/null +++ b/tests/auto/qml/qqmlcomponent/data/callingQmlContext.qml @@ -0,0 +1,13 @@ +import QtQml 2.0 +import qqmlcomponenttest 1.0 +QtObject { + property Component factory + property QtObject incubatedObject + + Component.onCompleted: { + var incubatorState = factory.incubateObject(null, { value: 42 }) + incubatorState.onStatusChanged = function(status) { + incubatedObject = incubatorState.object + } + } +} diff --git a/tests/auto/qml/qqmlcomponent/data/callingQmlContextComponent.qml b/tests/auto/qml/qqmlcomponent/data/callingQmlContextComponent.qml new file mode 100644 index 0000000000..adf491c87e --- /dev/null +++ b/tests/auto/qml/qqmlcomponent/data/callingQmlContextComponent.qml @@ -0,0 +1,3 @@ +import qqmlcomponenttest 1.0 +CallingContextCheckingClass { +} diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp index 85579a6019..680ea720a8 100644 --- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp +++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp @@ -40,6 +40,7 @@ #include <QtQuick> #include <QtQuick/private/qquickrectangle_p.h> #include <QtQuick/private/qquickmousearea_p.h> +#include <private/qv8engine_p.h> #include <qcolor.h> #include "../../shared/util.h" #include "testhttpserver.h" @@ -116,6 +117,7 @@ private slots: void onDestructionCount(); void recursion(); void recursionContinuation(); + void callingContextForInitialProperties(); private: QQmlEngine engine; @@ -523,6 +525,63 @@ void tst_qqmlcomponent::recursionContinuation() QVERIFY(object->property("success").toBool()); } +class CallingContextCheckingClass : public QObject +{ + Q_OBJECT + Q_PROPERTY(int value READ value WRITE setValue) +public: + CallingContextCheckingClass() + : m_value(0) + {} + + int value() const { return m_value; } + void setValue(int v) { + scopeObject.clear(); + callingContextData.setContextData(0); + + m_value = v; + QJSEngine *jsEngine = qjsEngine(this); + if (!jsEngine) + return; + QV4::ExecutionEngine *v4 = QV8Engine::getV4(jsEngine); + if (!v4) + return; + QV4::Scope scope(v4); + QV4::Scoped<QV4::QmlContext> qmlContext(scope, v4->qmlContext()); + if (!qmlContext) + return; + callingContextData = qmlContext->qmlContext(); + scopeObject = qmlContext->qmlScope(); + } + + int m_value; + QQmlGuardedContextData callingContextData; + QPointer<QObject> scopeObject; +}; + +void tst_qqmlcomponent::callingContextForInitialProperties() +{ + qmlRegisterType<CallingContextCheckingClass>("qqmlcomponenttest", 1, 0, "CallingContextCheckingClass"); + + QQmlComponent testFactory(&engine, testFileUrl("callingQmlContextComponent.qml")); + + QQmlComponent component(&engine, testFileUrl("callingQmlContext.qml")); + QScopedPointer<QObject> root(component.beginCreate(engine.rootContext())); + QVERIFY(!root.isNull()); + root->setProperty("factory", QVariant::fromValue(&testFactory)); + component.completeCreate(); + QTRY_VERIFY(qvariant_cast<QObject *>(root->property("incubatedObject"))); + QObject *o = qvariant_cast<QObject *>(root->property("incubatedObject")); + CallingContextCheckingClass *checker = qobject_cast<CallingContextCheckingClass*>(o); + QVERIFY(checker); + + QVERIFY(!checker->callingContextData.isNull()); + QVERIFY(checker->callingContextData->urlString().endsWith(QStringLiteral("callingQmlContext.qml"))); + + QVERIFY(!checker->scopeObject.isNull()); + QVERIFY(checker->scopeObject->metaObject()->indexOfProperty("incubatedObject") != -1); +} + QTEST_MAIN(tst_qqmlcomponent) #include "tst_qqmlcomponent.moc" diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp index 90c78ec942..20031c24d9 100644 --- a/tests/auto/quick/examples/tst_examples.cpp +++ b/tests/auto/quick/examples/tst_examples.cpp @@ -79,15 +79,14 @@ private: tst_examples::tst_examples() { // Add files to exclude here - excludedFiles << "examples/quick/canvas/tiger/tiger.qml"; // QTBUG-26528 excludedFiles << "snippets/qml/listmodel/listmodel.qml"; //Just a ListModel, no root QQuickItem excludedFiles << "examples/quick/demos/photosurface/photosurface.qml"; // root item is Window rather than Item - // Add directories you want excluded here (don't add examples/, because they install to examples/qtdeclarative/) + // Add directories you want excluded here excludedDirs << "shared"; //Not an example - excludedDirs << "quick/text/fonts"; // QTBUG-29004 excludedDirs << "snippets/qml/path"; //No root QQuickItem - excludedDirs << "tutorials/gettingStartedQml"; //C++ example, but no cpp files in root dir + excludedDirs << "examples/qml/qmlextensionplugins"; //Requires special import search path + excludedDirs << "examples/quick/tutorials/gettingStartedQml"; //C++ example, but no cpp files in root dir // These snippets are not expected to run on their own. excludedDirs << "snippets/qml/visualdatamodel_rootindex"; @@ -175,9 +174,8 @@ void tst_examples::namingConvention(const QDir &d) void tst_examples::namingConvention() { QStringList examplesLocations; - examplesLocations << QLibraryInfo::location(QLibraryInfo::ExamplesPath) + QLatin1String("/qtdeclarative"); - examplesLocations << QLibraryInfo::location(QLibraryInfo::ExamplesPath) + QLatin1String("/qtquick"); - examplesLocations << QLibraryInfo::location(QLibraryInfo::ExamplesPath) + QLatin1String("/qtqml"); + examplesLocations << QLibraryInfo::location(QLibraryInfo::ExamplesPath) + QLatin1String("/qml"); + examplesLocations << QLibraryInfo::location(QLibraryInfo::ExamplesPath) + QLatin1String("/quick"); foreach(const QString &examples, examplesLocations) { QDir d(examples); diff --git a/tests/auto/shared/imports.pri b/tests/auto/shared/imports.pri index 20e9bcb371..9cbf286386 100644 --- a/tests/auto/shared/imports.pri +++ b/tests/auto/shared/imports.pri @@ -1,7 +1,4 @@ -copyimportfiles.input = IMPORT_FILES -copyimportfiles.output = $$DESTDIR/${QMAKE_FILE_IN_BASE}${QMAKE_FILE_EXT} -copyimportfiles.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} -copyimportfiles.CONFIG += no_link_no_clean -copyimportfiles.variable_out = PRE_TARGETDEPS -QMAKE_EXTRA_COMPILERS += copyimportfiles +importfiles.files = $$IMPORT_FILES +importfiles.path = $$DESTDIR +COPIES += importfiles diff --git a/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy.pro b/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy.pro index 3e690d389f..81975ee01c 100644 --- a/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy.pro +++ b/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy.pro @@ -18,11 +18,9 @@ HEADERS += \ DISTFILES = qmldir !equals(_PRO_FILE_PWD_, $$OUT_PWD) { - copy_qmldir.target = $$OUT_PWD/qmldir - copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir - copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\" - QMAKE_EXTRA_TARGETS += copy_qmldir - PRE_TARGETDEPS += $$copy_qmldir.target + cpqmldir.files = qmldir + cpqmldir.path = $$OUT_PWD + COPIES += cpqmldir } qmldir.files = qmldir diff --git a/tests/manual/qmlplugindump/tests/dumper/Imports/imports.pro b/tests/manual/qmlplugindump/tests/dumper/Imports/imports.pro index fe9caea13a..1033c7a28f 100644 --- a/tests/manual/qmlplugindump/tests/dumper/Imports/imports.pro +++ b/tests/manual/qmlplugindump/tests/dumper/Imports/imports.pro @@ -18,11 +18,9 @@ HEADERS += \ DISTFILES = qmldir !equals(_PRO_FILE_PWD_, $$OUT_PWD) { - copy_qmldir.target = $$OUT_PWD/qmldir - copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir - copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\" - QMAKE_EXTRA_TARGETS += copy_qmldir - PRE_TARGETDEPS += $$copy_qmldir.target + cpqmldir.files = qmldir + cpqmldir.path = $$OUT_PWD + COPIES += cpqmldir } qmldir.files = qmldir diff --git a/tests/manual/qmlplugindump/tests/dumper/Versions/versions.pro b/tests/manual/qmlplugindump/tests/dumper/Versions/versions.pro index 951f886368..d59470862d 100644 --- a/tests/manual/qmlplugindump/tests/dumper/Versions/versions.pro +++ b/tests/manual/qmlplugindump/tests/dumper/Versions/versions.pro @@ -18,11 +18,9 @@ HEADERS += \ DISTFILES = qmldir !equals(_PRO_FILE_PWD_, $$OUT_PWD) { - copy_qmldir.target = $$OUT_PWD/qmldir - copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir - copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\" - QMAKE_EXTRA_TARGETS += copy_qmldir - PRE_TARGETDEPS += $$copy_qmldir.target + cpqmldir.files = qmldir + cpqmldir.path = $$OUT_PWD + COPIES += cpqmldir } qmldir.files = qmldir |