Use the base implementation of QAbstractItemModel::sibling in QSIM.
QStandardItemModel doesn't really benefit from a reimplementation of sibling, and the current implementation is buggy. Task-number: 29540 Change-Id: Icf8dca29b6e1394a378db5bf6abd884f2d7fd9b9 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>bb10
parent
97e755945c
commit
f136701bc5
|
|
@ -2714,7 +2714,7 @@ bool QStandardItemModel::hasChildren(const QModelIndex &parent) const
|
|||
*/
|
||||
QModelIndex QStandardItemModel::sibling(int row, int column, const QModelIndex &idx) const
|
||||
{
|
||||
return createIndex(row, column, idx.internalPointer());
|
||||
return QAbstractItemModel::sibling(row, column, idx);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -332,6 +332,7 @@ public:
|
|||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
|
||||
// Qt 6: Remove
|
||||
QModelIndex sibling(int row, int column, const QModelIndex &idx) const;
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
|
|
|
|||
|
|
@ -718,6 +718,8 @@ void tst_QStandardItemModel::checkChildren()
|
|||
QVERIFY(!model.hasChildren());
|
||||
QCOMPARE(model.rowCount(), 0);
|
||||
QCOMPARE(model.columnCount(), 1);
|
||||
|
||||
QVERIFY(!model.index(0,0).sibling(100,100).isValid());
|
||||
}
|
||||
|
||||
void tst_QStandardItemModel::data()
|
||||
|
|
|
|||
Loading…
Reference in New Issue