mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-04 10:45:34 +00:00
Proper index creation for nested data
This commit is contained in:
parent
fcf9ae42f4
commit
c088cd4fa9
2 changed files with 5 additions and 5 deletions
|
@ -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…
Reference in a new issue