Proper index creation for nested data

sceneinput
Stanislav Bas 10 years ago
parent fcf9ae42f4
commit c088cd4fa9

@ -171,10 +171,10 @@ QModelIndex CSMWorld::IdTree::index (int row, int column, const QModelIndex& par
encodedId = this->foldIndexAddress(parent);
}
if (row<0 || row>=idCollection()->getSize())
if (row < 0 || row >= rowCount(parent))
return QModelIndex();
if (column<0 || column>=idCollection()->getColumns())
if (column < 0 || column >= columnCount(parent))
return QModelIndex();
return createIndex(row, column, encodedId); // store internal id

@ -75,10 +75,10 @@ QModelIndex CSMWorld::NestedTableProxyModel::index(int row, int column, const QM
{
assert (!parent.isValid());
int rows = mMainModel->rowCount(parent);
int columns = mMainModel->columnCount(parent);
int numRows = rowCount(parent);
int numColumns = columnCount(parent);
if (row < 0 || row >= rows || column < 0 || column >= columns)
if (row < 0 || row >= numRows || column < 0 || column >= numColumns)
return QModelIndex();
return createIndex(row, column);

Loading…
Cancel
Save