Fix QAbstractItemModel::moveColumn()

Task-number: QTBUG-30346
Change-Id: I3d6dbe1e88bb5e2748eadabb2663f30be16f8d18
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
This commit is contained in:
J-P Nurmi 2013-04-23 12:31:23 +02:00 committed by The Qt Project
parent e324f5bc0e
commit a7dc708eb5
2 changed files with 5 additions and 1 deletions

View File

@ -405,7 +405,7 @@ inline bool QAbstractItemModel::moveRow(const QModelIndex &sourceParent, int sou
{ return moveRows(sourceParent, sourceRow, 1, destinationParent, destinationChild); }
inline bool QAbstractItemModel::moveColumn(const QModelIndex &sourceParent, int sourceColumn,
const QModelIndex &destinationParent, int destinationChild)
{ return moveRows(sourceParent, sourceColumn, 1, destinationParent, destinationChild); }
{ return moveColumns(sourceParent, sourceColumn, 1, destinationParent, destinationChild); }
inline QModelIndex QAbstractItemModel::createIndex(int arow, int acolumn, void *adata) const
{ return QModelIndex(arow, acolumn, adata, this); }
inline QModelIndex QAbstractItemModel::createIndex(int arow, int acolumn, quintptr aid) const

View File

@ -891,6 +891,10 @@ void tst_QAbstractItemModel::moveColumns()
QCOMPARE(model.moveColumns(QModelIndex(), 6, 4, QModelIndex(), 1), true);
QCOMPARE(columnsAboutToBeMovedSpy.count(), 1);
QCOMPARE(columnsMovedSpy.count(), 1);
QCOMPARE(model.moveColumn(QModelIndex(), 4, QModelIndex(), 1), true);
QCOMPARE(columnsAboutToBeMovedSpy.count(), 2);
QCOMPARE(columnsMovedSpy.count(), 2);
}
void tst_QAbstractItemModel::reset()