diff options
author | Stephen Kelly <steveire@gmail.com> | 2009-07-23 11:04:25 +0100 |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-08-26 16:26:12 +0200 |
commit | fad842cebeab8cba78141edd10756a51885f448b (patch) | |
tree | a7712e07626199caf2d77e24fce12cfb1196ab1e /src/corelib/kernel/qabstractitemmodel_p.h | |
parent | 743117fa94b5e8807b0b9f9b16f2a712e6bfb47f (diff) |
Add move API to QAbstractItemModel.
This adds the function beginMoveRows, endMoveRows, beginMoveColumns,
endMoveColumns
Reviewed-by: Olivier Goffart <ogoffart@trolltech.com>
Acknowledged-by: Thierry
Merge-request: 972
Diffstat (limited to 'src/corelib/kernel/qabstractitemmodel_p.h')
-rw-r--r-- | src/corelib/kernel/qabstractitemmodel_p.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/kernel/qabstractitemmodel_p.h b/src/corelib/kernel/qabstractitemmodel_p.h index e81e62771e..aae3cba904 100644 --- a/src/corelib/kernel/qabstractitemmodel_p.h +++ b/src/corelib/kernel/qabstractitemmodel_p.h @@ -80,6 +80,7 @@ class Q_CORE_EXPORT QAbstractItemModelPrivate : public QObjectPrivate public: QAbstractItemModelPrivate() : QObjectPrivate(), supportedDragActions(-1), roleNames(defaultRoleNames()) {} void removePersistentIndexData(QPersistentModelIndexData *data); + void movePersistentIndexes(QVector<QPersistentModelIndexData *> indexes, int change, const QModelIndex &parent, Qt::Orientation orientation); void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last); void rowsInserted(const QModelIndex &parent, int first, int last); void rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last); @@ -91,6 +92,10 @@ public: static QAbstractItemModel *staticEmptyModel(); static bool variantLessThan(const QVariant &v1, const QVariant &v2); + void itemsAboutToBeMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation); + void itemsMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation); + bool allowMove(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation); + inline QModelIndex createIndex(int row, int column, void *data = 0) const { return q_func()->createIndex(row, column, data); } @@ -132,6 +137,8 @@ public: Change(const QModelIndex &p, int f, int l) : parent(p), first(f), last(l) {} QModelIndex parent; int first, last; + + bool isValid() { return first >= 0 && last >= 0; } }; QStack<Change> changes; |