diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/doc/src/cppintegration/data.qdoc | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlvmemetaobject_p.h | 2 | ||||
-rw-r--r-- | src/qml/types/qqmllistmodel.cpp | 66 | ||||
-rw-r--r-- | src/qml/types/qqmllistmodel_p.h | 2 | ||||
-rw-r--r-- | src/qml/types/qqmllistmodel_p_p.h | 1 | ||||
-rw-r--r-- | src/qml/types/qqmlobjectmodel.cpp | 6 | ||||
-rw-r--r-- | src/quick/doc/snippets/qml/texteditor.qml | 1 | ||||
-rw-r--r-- | src/quick/items/qquickloader.cpp | 1 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgnode.cpp | 3 |
9 files changed, 37 insertions, 47 deletions
diff --git a/src/qml/doc/src/cppintegration/data.qdoc b/src/qml/doc/src/cppintegration/data.qdoc index c748161ee8..54a556b783 100644 --- a/src/qml/doc/src/cppintegration/data.qdoc +++ b/src/qml/doc/src/cppintegration/data.qdoc @@ -174,7 +174,6 @@ function, passing a QVariantList and a QVariantMap, which are automatically converted to JavaScript array and object values, repectively: \table -\header \row \li QML \li \snippet qml/qtbinding/variantlistmap/MyItem.qml 0 @@ -213,7 +212,6 @@ a \c Date object that is automatically converted into a QDateTime value when it is received in C++: \table -\header \row \li QML \li diff --git a/src/qml/qml/qqmlvmemetaobject_p.h b/src/qml/qml/qqmlvmemetaobject_p.h index ea5e9c0904..891db5eb3f 100644 --- a/src/qml/qml/qqmlvmemetaobject_p.h +++ b/src/qml/qml/qqmlvmemetaobject_p.h @@ -112,6 +112,8 @@ public: if (it->m_propertyIndex == propertyIndex) return true; } + if (auto parentInterceptor = ((parent.isT1() && parent.flag()) ? static_cast<QQmlInterceptorMetaObject *>(parent.asT1()) : 0)) + return parentInterceptor->intercepts(propertyIndex); return false; } diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index d088a5da42..d72d2e9487 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -341,7 +341,9 @@ ListModel::ListModel(ListLayout *layout, QQmlListModel *modelCache, int uid) : m void ListModel::destroy() { - clear(); + for (const auto &destroyer : remove(0, elements.count())) + destroyer(); + m_uid = -1; m_layout = 0; if (m_modelCache && m_modelCache->m_primary == false) @@ -562,16 +564,6 @@ void ListModel::set(int elementIndex, QV4::Object *object) } } -void ListModel::clear() -{ - int elementCount = elements.count(); - for (int i=0 ; i < elementCount ; ++i) { - elements[i]->destroy(m_layout); - delete elements[i]; - } - elements.clear(); -} - QVector<std::function<void()>> ListModel::remove(int index, int count) { QVector<std::function<void()>> toDestroy; @@ -2031,18 +2023,7 @@ int QQmlListModel::count() const */ void QQmlListModel::clear() { - const int cleared = count(); - - emitItemsAboutToBeRemoved(0, cleared); - - if (m_dynamicRoles) { - qDeleteAll(m_modelObjects); - m_modelObjects.clear(); - } else { - m_listModel->clear(); - } - - emitItemsRemoved(0, cleared); + removeElements(0, count()); } /*! @@ -2066,27 +2047,32 @@ void QQmlListModel::remove(QQmlV4Function *args) return; } - emitItemsAboutToBeRemoved(index, removeCount); + removeElements(index, removeCount); + } else { + qmlWarning(this) << tr("remove: incorrect number of arguments"); + } +} - QVector<std::function<void()>> toDestroy; - if (m_dynamicRoles) { - for (int i=0 ; i < removeCount ; ++i) { - auto modelObject = m_modelObjects[index+i]; - toDestroy.append([modelObject](){ - delete modelObject; - }); - } - m_modelObjects.remove(index, removeCount); - } else { - toDestroy = m_listModel->remove(index, removeCount); - } +void QQmlListModel::removeElements(int index, int removeCount) +{ + emitItemsAboutToBeRemoved(index, removeCount); - emitItemsRemoved(index, removeCount); - for (const auto &destroyer : toDestroy) - destroyer(); + QVector<std::function<void()>> toDestroy; + if (m_dynamicRoles) { + for (int i=0 ; i < removeCount ; ++i) { + auto modelObject = m_modelObjects[index+i]; + toDestroy.append([modelObject](){ + delete modelObject; + }); + } + m_modelObjects.remove(index, removeCount); } else { - qmlWarning(this) << tr("remove: incorrect number of arguments"); + toDestroy = m_listModel->remove(index, removeCount); } + + emitItemsRemoved(index, removeCount); + for (const auto &destroyer : toDestroy) + destroyer(); } /*! diff --git a/src/qml/types/qqmllistmodel_p.h b/src/qml/types/qqmllistmodel_p.h index b750d30676..1fda703797 100644 --- a/src/qml/types/qqmllistmodel_p.h +++ b/src/qml/types/qqmllistmodel_p.h @@ -165,6 +165,8 @@ private: void emitItemsInserted(int index, int count); void emitItemsAboutToBeMoved(int from, int to, int n); void emitItemsMoved(int from, int to, int n); + + void removeElements(int index, int removeCount); }; // ### FIXME diff --git a/src/qml/types/qqmllistmodel_p_p.h b/src/qml/types/qqmllistmodel_p_p.h index 77d2002afa..271437e680 100644 --- a/src/qml/types/qqmllistmodel_p_p.h +++ b/src/qml/types/qqmllistmodel_p_p.h @@ -366,7 +366,6 @@ public: int append(QV4::Object *object); void insert(int elementIndex, QV4::Object *object); - void clear(); Q_REQUIRED_RESULT QVector<std::function<void()>> remove(int index, int count); int appendElement(); diff --git a/src/qml/types/qqmlobjectmodel.cpp b/src/qml/types/qqmlobjectmodel.cpp index 64d0169f6b..dcd0360199 100644 --- a/src/qml/types/qqmlobjectmodel.cpp +++ b/src/qml/types/qqmlobjectmodel.cpp @@ -72,7 +72,7 @@ public: int ref; }; - QQmlObjectModelPrivate() : QObjectPrivate() {} + QQmlObjectModelPrivate() : QObjectPrivate(), moveId(0) {} static void children_append(QQmlListProperty<QObject> *prop, QObject *item) { int index = static_cast<QQmlObjectModelPrivate *>(prop->data)->children.count(); @@ -129,7 +129,7 @@ public: } QQmlChangeSet changeSet; - changeSet.move(from, to, n, 0); + changeSet.move(from, to, n, ++moveId); emit q->modelUpdated(changeSet, false); emit q->childrenChanged(); } @@ -166,7 +166,7 @@ public: return -1; } - + uint moveId; QList<Item> children; }; diff --git a/src/quick/doc/snippets/qml/texteditor.qml b/src/quick/doc/snippets/qml/texteditor.qml index 7da9086e10..9bf13fb27c 100644 --- a/src/quick/doc/snippets/qml/texteditor.qml +++ b/src/quick/doc/snippets/qml/texteditor.qml @@ -63,7 +63,6 @@ Flickable { TextEdit { id: edit width: flick.width - height: flick.height focus: true wrapMode: TextEdit.Wrap onCursorRectangleChanged: flick.ensureVisible(cursorRectangle) diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp index 9f27beb298..cd356a9eeb 100644 --- a/src/quick/items/qquickloader.cpp +++ b/src/quick/items/qquickloader.cpp @@ -852,6 +852,7 @@ qreal QQuickLoader::progress() const \qmlproperty bool QtQuick::Loader::asynchronous This property holds whether the component will be instantiated asynchronously. +By default it is \c false. When used in conjunction with the \l source property, loading and compilation will also be performed in a background thread. diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp index 264b30b897..22d57001fc 100644 --- a/src/quick/scenegraph/coreapi/qsgnode.cpp +++ b/src/quick/scenegraph/coreapi/qsgnode.cpp @@ -1079,6 +1079,7 @@ void QSGGeometryNode::setInheritedOpacity(qreal opacity) QSGClipNode::QSGClipNode() : QSGBasicGeometryNode(ClipNodeType) + , m_is_rectangular(false) { Q_UNUSED(m_reserved); } @@ -1114,6 +1115,8 @@ QSGClipNode::~QSGClipNode() When this hint is set and it is applicable, the clip region will be generated from clipRect() rather than geometry(). + + By default this property is \c false. */ void QSGClipNode::setIsRectangular(bool rectHint) |