mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-21 07:39:40 +00:00
Add ColumnId role to the IdTree data methods
This commit is contained in:
parent
5e8718d8b2
commit
602f33bd91
1 changed files with 12 additions and 11 deletions
|
@ -35,28 +35,26 @@ QVariant CSMWorld::IdTree::data (const QModelIndex & index, int role) const
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
if ((role!=Qt::DisplayRole && role!=Qt::EditRole) || index.row() < 0 || index.column() < 0)
|
|
||||||
return QVariant();
|
|
||||||
|
|
||||||
if (index.internalId() != 0)
|
if (index.internalId() != 0)
|
||||||
{
|
{
|
||||||
std::pair<int, int> parentAddress(unfoldIndexAddress(index.internalId()));
|
std::pair<int, int> parentAddress(unfoldIndexAddress(index.internalId()));
|
||||||
|
const NestableColumn *parentColumn = mNestedCollection->getNestableColumn(parentAddress.second);
|
||||||
|
|
||||||
if (role == Qt::EditRole &&
|
if (role == ColumnBase::Role_ColumnId)
|
||||||
!mNestedCollection->getNestableColumn(parentAddress.second)->nestedColumn(index.column()).isEditable())
|
return parentColumn->nestedColumn(index.column()).mColumnId;
|
||||||
{
|
|
||||||
|
if (role == Qt::EditRole && !parentColumn->nestedColumn(index.column()).isEditable())
|
||||||
|
return QVariant();
|
||||||
|
|
||||||
|
if (role != Qt::DisplayRole && role != Qt::EditRole)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
|
||||||
|
|
||||||
return mNestedCollection->getNestedData(parentAddress.first,
|
return mNestedCollection->getNestedData(parentAddress.first,
|
||||||
parentAddress.second, index.row(), index.column());
|
parentAddress.second, index.row(), index.column());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (role==Qt::EditRole && !idCollection()->getColumn (index.column()).isEditable())
|
return IdTable::data(index, role);
|
||||||
return QVariant();
|
|
||||||
|
|
||||||
return idCollection()->getData (index.row(), index.column());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,6 +77,9 @@ QVariant CSMWorld::IdTree::nestedHeaderData(int section, int subSection, Qt::Ori
|
||||||
if (role==ColumnBase::Role_Display)
|
if (role==ColumnBase::Role_Display)
|
||||||
return parentColumn->nestedColumn(subSection).mDisplayType;
|
return parentColumn->nestedColumn(subSection).mDisplayType;
|
||||||
|
|
||||||
|
if (role==ColumnBase::Role_ColumnId)
|
||||||
|
return parentColumn->nestedColumn(subSection).mColumnId;
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue