diff options
author | Mark Brand <mabrand@mabrand.nl> | 2011-04-10 21:48:36 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-24 19:12:23 +0100 |
commit | 764840ec0e189b4a9f76cdd659d82a2a50324190 (patch) | |
tree | 42b40caa1892cd1c219b2865b2e7e3bcb529234e /src/corelib/itemmodels/qabstractitemmodel.cpp | |
parent | af48e0ba36aed330e8b262687e3192d7e09796f7 (diff) |
add missing move* methods to QAbstractItemModel
The existence of QAbstractItemModel virtual methods
moveRow, moveColumn, moveRows, and moveColumns
is implied by the existence of
beginMoveRows, endMoveRows, beginMoveColumns and endMoveColumns.
However, these were not actually provided by QAbstractItemModel.
With this change, subclasses can implement support for moving rows
and columns following the same pattern as for insert* and remove*.
Change-Id: Iad8b2223d4b9303abb6459c174a82ffed71a0fdf
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'src/corelib/itemmodels/qabstractitemmodel.cpp')
-rw-r--r-- | src/corelib/itemmodels/qabstractitemmodel.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index cdc9466a0b..50a63e28da 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -1959,6 +1959,48 @@ bool QAbstractItemModel::removeColumns(int, int, const QModelIndex &) } /*! + On models that support this, moves \a count rows starting with the given + \a sourceRow under parent \a sourceParent to row \a destinationChild under + \a parent \a destinationParent. + + Returns true if the rows were successfully moved; otherwise returns + false. + + The base class implementation does nothing and returns false. + + If you implement your own model, you can reimplement this function if you + want to support moving. Alternatively, you can provide your own API for + altering the data. + + \sa beginMoveRows(), endMoveRows() +*/ +bool QAbstractItemModel::moveRows(const QModelIndex &, int , int , const QModelIndex &, int) +{ + return false; +} + +/*! + On models that support this, moves \a count columns starting with the given + \a sourceColumn under parent \a sourceParent to column \a destinationChild under + \a parent \a destinationParent. + + Returns true if the columns were successfully moved; otherwise returns + false. + + The base class implementation does nothing and returns false. + + If you implement your own model, you can reimplement this function if you + want to support moving. Alternatively, you can provide your own API for + altering the data. + + \sa beginMoveColumns(), endMoveColumns() +*/ +bool QAbstractItemModel::moveColumns(const QModelIndex &, int , int , const QModelIndex &, int) +{ + return false; +} + +/*! Fetches any available data for the items with the parent specified by the \a parent index. |