diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-06-25 09:53:01 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-06-25 12:15:55 +0200 |
commit | fbf6f7400a5b5ae10267171e201391ce1ff8eb96 (patch) | |
tree | 18e22092c2764fea16442fd814f230d4fe095a49 /src/qml | |
parent | c21a6a9f2c2d635aca3bf88a6431c560b16b1cc6 (diff) | |
parent | 9999591e69a0908cd3fbe14646fb98881e32061b (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp
src/quick/handlers/qquickhandlerpoint.cpp
src/quick/handlers/qquicksinglepointhandler.cpp
tests/auto/qml/ecmascripttests/test262
Change-Id: I8908ec8c6116ca626fbd269af7625d4c429429ca
Diffstat (limited to 'src/qml')
26 files changed, 93 insertions, 52 deletions
diff --git a/src/qml/doc/snippets/code/doc_src_qtqml.cpp b/src/qml/doc/snippets/code/doc_src_qtqml.cpp new file mode 100644 index 0000000000..745e2f8f94 --- /dev/null +++ b/src/qml/doc/snippets/code/doc_src_qtqml.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [0] +#include <QtQml> +//! [0] diff --git a/src/qml/doc/snippets/code/doc_src_qtqml.pro b/src/qml/doc/snippets/code/doc_src_qtqml.pro new file mode 100644 index 0000000000..48dc3ebf6c --- /dev/null +++ b/src/qml/doc/snippets/code/doc_src_qtqml.pro @@ -0,0 +1,3 @@ +#! [0] +QT += qml +#! [0] diff --git a/src/qml/doc/src/javascript/date.qdoc b/src/qml/doc/src/javascript/date.qdoc index 7b574e7c3b..431f9649a0 100644 --- a/src/qml/doc/src/javascript/date.qdoc +++ b/src/qml/doc/src/javascript/date.qdoc @@ -28,7 +28,7 @@ /*! \qmltype Date \inqmlmodule QtQml - \brief Provides date functions + \brief Provides date functions. The QML Date object extends the \l{Mozilla Developer Network Date Reference}{JS Date object} with diff --git a/src/qml/doc/src/javascript/number.qdoc b/src/qml/doc/src/javascript/number.qdoc index 5230d08bc9..b6f80f474a 100644 --- a/src/qml/doc/src/javascript/number.qdoc +++ b/src/qml/doc/src/javascript/number.qdoc @@ -28,7 +28,7 @@ /*! \qmltype Number \inqmlmodule QtQml - \brief The Number object provides represents a number value + \brief The Number object provides represents a number value. The QML Number object extends the JS Number object with locale aware functions. diff --git a/src/qml/doc/src/javascript/string.qdoc b/src/qml/doc/src/javascript/string.qdoc index c434bb867d..f896af3378 100644 --- a/src/qml/doc/src/javascript/string.qdoc +++ b/src/qml/doc/src/javascript/string.qdoc @@ -28,7 +28,7 @@ /*! \qmltype String \inqmlmodule QtQml - \brief The String object represents a string value + \brief The String object represents a string value. The QML String object extends the JS String object with the arg() function. diff --git a/src/qml/doc/src/qtqml-cpp.qdoc b/src/qml/doc/src/qtqml-cpp.qdoc index fd45222d85..971bb88825 100644 --- a/src/qml/doc/src/qtqml-cpp.qdoc +++ b/src/qml/doc/src/qtqml-cpp.qdoc @@ -29,21 +29,17 @@ \title Qt QML C++ Classes \ingroup modules \qtvariable qml -\brief The C++ API provided by the Qt QML module +\brief The C++ API provided by the Qt QML module. To include the definitions of the module's classes, use the following directive: -\code -#include <QtQml> -\endcode +\snippet code/doc_src_qtqml.cpp 0 To link against the module, add this line to your \l qmake \c .pro file: -\code -QT += qml -\endcode +\snippet code/doc_src_qtqml.pro 0 For more information on the Qt QML module, see the \l{Qt QML} module documentation. diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp index 6718f2637c..ecc0b138c0 100644 --- a/src/qml/jsruntime/qv4arraydata.cpp +++ b/src/qml/jsruntime/qv4arraydata.cpp @@ -162,8 +162,6 @@ void ArrayData::realloc(Object *o, Type newType, uint requested, bool enforceAtt } newData->setAlloc(alloc); newData->setType(newType); - if (d) - newData->d()->needsMark = d->d()->needsMark; newData->setAttrs(enforceAttributes ? reinterpret_cast<PropertyAttributes *>(newData->d()->values.values + alloc) : nullptr); o->setArrayData(newData); @@ -186,8 +184,6 @@ void ArrayData::realloc(Object *o, Type newType, uint requested, bool enforceAtt memcpy(newData->d()->values.values, d->d()->values.values + offset, sizeof(Value)*toCopy); } - if (newType != Heap::ArrayData::Simple) - newData->d()->needsMark = true; if (newType != Heap::ArrayData::Sparse) return; diff --git a/src/qml/jsruntime/qv4arraydata_p.h b/src/qml/jsruntime/qv4arraydata_p.h index 887b8f283f..ac5b430356 100644 --- a/src/qml/jsruntime/qv4arraydata_p.h +++ b/src/qml/jsruntime/qv4arraydata_p.h @@ -92,7 +92,7 @@ namespace Heap { #define ArrayDataMembers(class, Member) \ Member(class, NoMark, ushort, type) \ - Member(class, NoMark, ushort, needsMark) \ + Member(class, NoMark, ushort, unused) \ Member(class, NoMark, uint, offset) \ Member(class, NoMark, PropertyAttributes *, attrs) \ Member(class, NoMark, SparseArray *, sparse) \ @@ -135,8 +135,6 @@ struct SimpleArrayData : public ArrayData { uint mappedIndex(uint index) const { index += offset; if (index >= values.alloc) index -= values.alloc; return index; } const Value &data(uint index) const { return values[mappedIndex(index)]; } void setData(EngineBase *e, uint index, Value newVal) { - if (newVal.isManaged()) - needsMark = true; values.set(e, mappedIndex(index), newVal); } diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index a8331f153e..1073a2abab 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -709,12 +709,6 @@ Heap::ArrayObject *ExecutionEngine::newArrayObject(const Value *values, int leng // this doesn't require a write barrier, things will be ok, when the new array data gets inserted into // the parent object memcpy(&d->values.values, values, length*sizeof(Value)); - for (int i = 0; i < length; ++i) { - if (values[i].isManaged()) { - d->needsMark = true; - break; - } - } a->d()->arrayData.set(this, d); a->setArrayLengthUnchecked(length); } diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index 516e9b3c65..79a63d1ee6 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -250,11 +250,8 @@ void Heap::Object::markObjects(Heap::Base *b, MarkStack *stack) Object *o = static_cast<Object *>(b); if (o->memberData) o->memberData->mark(stack); - if (o->arrayData) { - o->arrayData->setMarkBit(); - if (o->arrayData->needsMark) - ArrayData::markObjects(o->arrayData, stack); - } + if (o->arrayData) + o->arrayData->mark(stack); uint nInline = o->vtable()->nInlineProperties; Value *v = reinterpret_cast<Value *>(o) + o->vtable()->inlinePropertyOffset; const Value *end = v + nInline; diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index ca6e4c50b1..efd528860f 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -91,9 +91,10 @@ void Script::parse() Module module(v4->debugger() != nullptr); if (sourceCode.startsWith(QLatin1String("function("))) { - qWarning() << "Warning: Using function expressions as statements in scripts in not compliant with the ECMAScript specification at\n" - << (sourceCode.leftRef(70) + QLatin1String("...")) - << "\nThis will throw a syntax error in Qt 5.12. If you want a function expression, surround it by parentheses."; + static const int snippetLength = 70; + qWarning() << "Warning: Using function expressions as statements in scripts is not compliant with the ECMAScript specification:\n" + << (sourceCode.leftRef(snippetLength) + QLatin1String("...")) + << "\nThis will throw a syntax error in Qt 5.12. If you want a function expression, surround it by parentheses."; } Engine ee, *engine = ⅇ diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 22e20de8d7..96f6c6aed6 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -89,7 +89,7 @@ V4_DEFINE_EXTENSION(QQmlComponentExtension, componentExtension); \since 5.0 \inmodule QtQml - \brief The QQmlComponent class encapsulates a QML component definition + \brief The QQmlComponent class encapsulates a QML component definition. Components are reusable, encapsulated QML types with well-defined interfaces. @@ -183,7 +183,7 @@ V4_DEFINE_EXTENSION(QQmlComponentExtension, componentExtension); \instantiates QQmlComponent \ingroup qml-utility-elements \inqmlmodule QtQml - \brief Encapsulates a QML component definition + \brief Encapsulates a QML component definition. Components are reusable, encapsulated QML types with well-defined interfaces. diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 61cf2a8994..759d86c789 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -159,7 +159,7 @@ int qmlRegisterUncreatableMetaObject(const QMetaObject &staticMetaObject, \instantiates QObject \inqmlmodule QtQml \ingroup qml-utility-elements - \brief A basic QML type + \brief A basic QML type. The QtObject type is a non-visual element which contains only the objectName property. diff --git a/src/qml/qml/qqmlfileselector.cpp b/src/qml/qml/qqmlfileselector.cpp index 8666144096..32dce8b4bc 100644 --- a/src/qml/qml/qqmlfileselector.cpp +++ b/src/qml/qml/qqmlfileselector.cpp @@ -52,7 +52,7 @@ Q_GLOBAL_STATIC(interceptorSelectorMap, interceptorInstances); \class QQmlFileSelector \since 5.2 \inmodule QtQml - \brief A class for applying a QFileSelector to QML file loading + \brief A class for applying a QFileSelector to QML file loading. QQmlFileSelector will automatically apply a QFileSelector to qml file and asset paths. diff --git a/src/qml/qml/qqmlincubator.cpp b/src/qml/qml/qqmlincubator.cpp index df168960c6..e18ce71902 100644 --- a/src/qml/qml/qqmlincubator.cpp +++ b/src/qml/qml/qqmlincubator.cpp @@ -176,7 +176,7 @@ void QQmlIncubatorPrivate::clear() /*! \class QQmlIncubationController -\brief QQmlIncubationController instances drive the progress of QQmlIncubators +\brief QQmlIncubationController instances drive the progress of QQmlIncubators. \inmodule QtQml In order to behave asynchronously and not introduce stutters or freezes in an application, diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp index f17f0fb77a..c5a85dd4d3 100644 --- a/src/qml/qml/qqmllocale.cpp +++ b/src/qml/qml/qqmllocale.cpp @@ -715,7 +715,7 @@ V4_DEFINE_EXTENSION(QV4LocaleDataDeletable, localeV4Data); \qmltype Locale \instantiates QQmlLocale \inqmlmodule QtQml - \brief Provides locale specific properties and formatted data + \brief Provides locale specific properties and formatted data. The Locale object may only be created via the \l{QtQml::Qt::locale()}{Qt.locale()} function. It cannot be created directly. diff --git a/src/qml/qml/qqmlloggingcategory.cpp b/src/qml/qml/qqmlloggingcategory.cpp index 08f8552ab6..597fe458fa 100644 --- a/src/qml/qml/qqmlloggingcategory.cpp +++ b/src/qml/qml/qqmlloggingcategory.cpp @@ -45,7 +45,7 @@ \qmltype LoggingCategory \ingroup qml-utility-elements \inqmlmodule QtQml - \brief Defines a logging category in QML + \brief Defines a logging category in QML. \since 5.8 A logging category can be passed to console.log() and friends as the first argument. diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp index bff16441d0..e4fe84bf25 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp @@ -1361,7 +1361,10 @@ void Heap::QQmlBindingFunction::init(const QV4::FunctionObject *bindingFunction) QQmlSourceLocation QQmlBindingFunction::currentLocation() const { QV4::CppStackFrame *frame = engine()->currentStackFrame; - return QQmlSourceLocation(frame->source(), frame->lineNumber(), 0); + if (frame->v4Function) // synchronous loading: + return QQmlSourceLocation(frame->source(), frame->lineNumber(), 0); + else // async loading: + return bindingFunction()->function->sourceLocation(); } DEFINE_OBJECT_VTABLE(QQmlBindingFunction); diff --git a/src/qml/types/qqmlconnections.cpp b/src/qml/types/qqmlconnections.cpp index 2ae3df6ebb..183bb1bf74 100644 --- a/src/qml/types/qqmlconnections.cpp +++ b/src/qml/types/qqmlconnections.cpp @@ -75,7 +75,7 @@ public: \instantiates QQmlConnections \inqmlmodule QtQml \ingroup qtquick-interceptors - \brief Describes generalized connections to signals + \brief Describes generalized connections to signals. A Connections object creates a connection to a QML signal. diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index 33fe5f3438..62ccf0d66c 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -164,7 +164,7 @@ QQmlDelegateModelParts::QQmlDelegateModelParts(QQmlDelegateModel *parent) \instantiates QQmlDelegateModel \inqmlmodule QtQuick \ingroup qtquick-models - \brief Encapsulates a model and delegate + \brief Encapsulates a model and delegate. The VisualDataModel type encapsulates a model and the delegate that will be instantiated for items in a model. @@ -179,7 +179,7 @@ QQmlDelegateModelParts::QQmlDelegateModelParts(QQmlDelegateModel *parent) \qmltype DelegateModel \instantiates QQmlDelegateModel \inqmlmodule QtQml.Models - \brief Encapsulates a model and delegate + \brief Encapsulates a model and delegate. The DelegateModel type encapsulates a model and the delegate that will be instantiated for items in the model. @@ -2369,7 +2369,7 @@ void QQmlDelegateModelGroupPrivate::destroyingPackage(QQuickPackage *package) \instantiates QQmlDelegateModelGroup \inqmlmodule QtQuick \ingroup qtquick-models - \brief Encapsulates a filtered set of visual data items + \brief Encapsulates a filtered set of visual data items. The VisualDataGroup type provides a means to address the model data of a model's delegate items, as well as sort and filter these delegate items. @@ -2385,7 +2385,7 @@ void QQmlDelegateModelGroupPrivate::destroyingPackage(QQuickPackage *package) \instantiates QQmlDelegateModelGroup \inqmlmodule QtQml.Models \ingroup qtquick-models - \brief Encapsulates a filtered set of visual data items + \brief Encapsulates a filtered set of visual data items. The DelegateModelGroup type provides a means to address the model data of a DelegateModel's delegate items, as well as sort and filter these delegate diff --git a/src/qml/types/qqmlinstantiator.cpp b/src/qml/types/qqmlinstantiator.cpp index 030758fa3b..a23ec0f2b4 100644 --- a/src/qml/types/qqmlinstantiator.cpp +++ b/src/qml/types/qqmlinstantiator.cpp @@ -221,7 +221,7 @@ void QQmlInstantiatorPrivate::makeModel() \qmltype Instantiator \instantiates QQmlInstantiator \inqmlmodule QtQml - \brief Dynamically creates objects + \brief Dynamically creates objects. A Instantiator can be used to control the dynamic creation of objects, or to dynamically create multiple objects from a template. diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index b4507cb264..0a9540bf4b 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -1791,7 +1791,7 @@ void DynamicRoleModelNodeMetaObject::propertyWritten(int index) \instantiates QQmlListModel \inqmlmodule QtQml.Models \ingroup qtquick-models - \brief Defines a free-form list data source + \brief Defines a free-form list data source. The ListModel is a simple container of ListElement definitions, each containing data roles. The contents can be defined dynamically, or @@ -2828,7 +2828,7 @@ bool QQmlListModelParser::definesEmptyList(const QString &s) \qmltype ListElement \instantiates QQmlListElement \inqmlmodule QtQml.Models - \brief Defines a data item in a ListModel + \brief Defines a data item in a ListModel. \ingroup qtquick-models List elements are defined inside ListModel definitions, and represent items in a diff --git a/src/qml/types/qqmlobjectmodel.cpp b/src/qml/types/qqmlobjectmodel.cpp index 08740b4a6f..d94af64fde 100644 --- a/src/qml/types/qqmlobjectmodel.cpp +++ b/src/qml/types/qqmlobjectmodel.cpp @@ -176,7 +176,7 @@ public: \instantiates QQmlObjectModel \inqmlmodule QtQml.Models \ingroup qtquick-models - \brief Defines a set of items to be used as a model + \brief Defines a set of items to be used as a model. An ObjectModel contains the visual items to be used in a view. When an ObjectModel is used in a view, the view does not require @@ -214,7 +214,7 @@ public: \qmltype VisualItemModel \instantiates QQmlObjectModel \inqmlmodule QtQuick - \brief Defines a set of objects to be used as a model + \brief Defines a set of objects to be used as a model. The VisualItemModel type contains the objects to be used as a model. diff --git a/src/qml/types/qqmltimer.cpp b/src/qml/types/qqmltimer.cpp index 6554010f36..af2ff56f2a 100644 --- a/src/qml/types/qqmltimer.cpp +++ b/src/qml/types/qqmltimer.cpp @@ -87,7 +87,7 @@ public: \instantiates QQmlTimer \inqmlmodule QtQml \ingroup qtquick-interceptors - \brief Triggers a handler at a specified interval + \brief Triggers a handler at a specified interval. A Timer can be used to trigger an action either once, or repeatedly at a given interval. diff --git a/src/qml/types/qquickpackage.cpp b/src/qml/types/qquickpackage.cpp index e8e897bab9..03539d8737 100644 --- a/src/qml/types/qquickpackage.cpp +++ b/src/qml/types/qquickpackage.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE \instantiates QQuickPackage \inqmlmodule QtQuick \ingroup qtquick-views - \brief Specifies a collection of named items + \brief Specifies a collection of named items. The Package type is used in conjunction with DelegateModel to enable delegates with a shared context diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp index 501de392e3..f8879160b2 100644 --- a/src/qml/types/qquickworkerscript.cpp +++ b/src/qml/types/qquickworkerscript.cpp @@ -578,7 +578,7 @@ void QQuickWorkerScriptEngine::run() \instantiates QQuickWorkerScript \ingroup qtquick-threading \inqmlmodule QtQuick - \brief Enables the use of threads in a Qt Quick application + \brief Enables the use of threads in a Qt Quick application. Use WorkerScript to run operations in a new thread. This is useful for running operations in the background so |