diff options
author | Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com> | 2015-03-06 19:27:22 +0100 |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com> | 2015-03-22 16:20:29 +0000 |
commit | 0271609d5136fa681306c2647973a26dadc7acb3 (patch) | |
tree | 4889a233a919266fbf38551a056cf8b49d7f2bd4 /src/qml/types/qqmlmodelindexvaluetype_p.h | |
parent | ae1c3eba3e7e11a9b1ab4d18792c82c9bb6e62de (diff) |
Remove QItemSelection value-type, use Array instead
We implement this by adding QItemSelection to the
set of sequence types.
Change-Id: Ia3db376c806d8f062639e22c7f4bf392f114c266
Reviewed-by: Stephen Kelly <steveire@gmail.com>
Diffstat (limited to 'src/qml/types/qqmlmodelindexvaluetype_p.h')
-rw-r--r-- | src/qml/types/qqmlmodelindexvaluetype_p.h | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/qml/types/qqmlmodelindexvaluetype_p.h b/src/qml/types/qqmlmodelindexvaluetype_p.h index e36f7a0d1e..371335c9f3 100644 --- a/src/qml/types/qqmlmodelindexvaluetype_p.h +++ b/src/qml/types/qqmlmodelindexvaluetype_p.h @@ -150,50 +150,6 @@ public: inline bool isEmpty() const { return v.isEmpty(); } }; -template<typename V, typename T> -QString q_listToString(const QList<T> &list, const QLatin1String &typeName) -{ - QString result = typeName; - result.append(QLatin1Char('(')); - for (typename QList<T>::size_type i = 0; i < list.count(); ++i) { - if (i) - result.append(QLatin1String(", ")); - result.append(reinterpret_cast<const V *>(&list.at(i))->toString()); - } - return result.append(QLatin1Char(')')); -} - -// Invokable QList<T> API forwarding for value types -#define QLISTVALUETYPE_QML_API(T) \ - Q_PROPERTY(int length READ length FINAL) \ - Q_INVOKABLE T at(int i) { return v.at(i); } \ - Q_INVOKABLE void append(const T &o) { v.append(o); } \ - Q_INVOKABLE void prepend(const T &o) { v.prepend(o); } \ - Q_INVOKABLE void insert(int i, const T &o) { v.insert(i, o); } \ - Q_INVOKABLE void removeFirst() { v.removeFirst(); } \ - Q_INVOKABLE void removeLast() { v.removeLast(); } \ - Q_INVOKABLE void removeAt(int i) { v.removeAt(i); } \ - int length() const { return v.length(); } - -struct QQmlItemSelectionValueType -{ - QItemSelection v; - - Q_GADGET - -public: - Q_INVOKABLE QString toString() - { return q_listToString<QQmlItemSelectionRangeValueType>(v, QLatin1String("QItemSelection")); } - Q_INVOKABLE void select(const QModelIndex &topLeft, const QModelIndex &bottomRight) - { v.select(topLeft, bottomRight); } - Q_INVOKABLE bool contains(const QModelIndex &index) const - { return v.contains(index); } - Q_INVOKABLE void merge(const QItemSelection &other, int command) - { v.merge(other, QItemSelectionModel::SelectionFlags(command)); } - - QLISTVALUETYPE_QML_API(QItemSelectionRange) -}; - #undef QLISTVALUETYPE_INVOKABLE_API QT_END_NAMESPACE |