From ae1c3eba3e7e11a9b1ab4d18792c82c9bb6e62de Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 3 Mar 2015 18:36:51 +0100 Subject: Remove QModelIndexList value type, use Array instead We implement this by adding QModelIndexList to the set of sequence types. Change-Id: If7e0e88ab0c2916c2b65a926f8241549520d7391 Reviewed-by: Stephen Kelly --- src/qml/types/qqmlitemmodels.qdoc | 17 ++++++++++++++--- src/qml/types/qqmlmodelindexvaluetype_p.h | 13 ------------- 2 files changed, 14 insertions(+), 16 deletions(-) (limited to 'src/qml/types') diff --git a/src/qml/types/qqmlitemmodels.qdoc b/src/qml/types/qqmlitemmodels.qdoc index 25c9321115..70059b07c6 100644 --- a/src/qml/types/qqmlitemmodels.qdoc +++ b/src/qml/types/qqmlitemmodels.qdoc @@ -60,6 +60,17 @@ should not store any QModelIndex. You can, however, store QPersistentModelIndexes in a safe way. + \section1 QModelIndexList + + \l QModelIndexList is exposed in QML as a JavaScript array. Conversions are + automatically made from and to C++. In fact, any JavaScript array can be + converted back to QModelIndexList, with non-QModelIndex objects replaced by + invalid QModelIndexes. + + \note QModelIndex to QPersistentModelIndex conversion happens when accessing + the array elements because any QModelIndexList property retains reference + semantics when exposed this way. + \section1 \l QItemSelectionRange \list @@ -87,10 +98,10 @@ \li QItemSelectionRange \b{intersected}(QItemSelectionRange other) \endlist - \section1 \l QModelIndexList and \l QItemSelection + \section1 QItemSelection - Both \l QModelIndexList and \l QItemSelection expose the following properties - and functions as part of their \l QList API: + \l QItemSelection exposes the following properties and functions as part of + its \l QList API: \list \li \b length : int diff --git a/src/qml/types/qqmlmodelindexvaluetype_p.h b/src/qml/types/qqmlmodelindexvaluetype_p.h index 0e655ab3d7..e36f7a0d1e 100644 --- a/src/qml/types/qqmlmodelindexvaluetype_p.h +++ b/src/qml/types/qqmlmodelindexvaluetype_p.h @@ -175,19 +175,6 @@ QString q_listToString(const QList &list, const QLatin1String &typeName) Q_INVOKABLE void removeAt(int i) { v.removeAt(i); } \ int length() const { return v.length(); } -struct QQmlModelIndexListValueType -{ - QModelIndexList v; - - Q_GADGET - -public: - Q_INVOKABLE QString toString() - { return q_listToString(v, QLatin1String("")); } - - QLISTVALUETYPE_QML_API(QModelIndex) -}; - struct QQmlItemSelectionValueType { QItemSelection v; -- cgit v1.2.3