mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-03 19:49:41 +00:00
make column type accessable via the regular table model
This commit is contained in:
parent
7615cbafce
commit
561ddfa0c5
2 changed files with 13 additions and 3 deletions
|
@ -15,7 +15,8 @@ namespace CSMWorld
|
||||||
enum Roles
|
enum Roles
|
||||||
{
|
{
|
||||||
Role_Flags = Qt::UserRole,
|
Role_Flags = Qt::UserRole,
|
||||||
Role_Display = Qt::UserRole+1
|
Role_Display = Qt::UserRole+1,
|
||||||
|
Role_ColumnId = Qt::UserRole+1
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Flags
|
enum Flags
|
||||||
|
|
|
@ -29,7 +29,13 @@ int CSMWorld::IdTable::columnCount (const QModelIndex & parent) const
|
||||||
|
|
||||||
QVariant CSMWorld::IdTable::data (const QModelIndex & index, int role) const
|
QVariant CSMWorld::IdTable::data (const QModelIndex & index, int role) const
|
||||||
{
|
{
|
||||||
if ((role!=Qt::DisplayRole && role!=Qt::EditRole) || index.row() < 0 || index.column() < 0)
|
if (index.row() < 0 || index.column() < 0)
|
||||||
|
return QVariant();
|
||||||
|
|
||||||
|
if (role==ColumnBase::Role_ColumnId)
|
||||||
|
return QVariant (getColumnId (index.column()));
|
||||||
|
|
||||||
|
if ((role!=Qt::DisplayRole && role!=Qt::EditRole))
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
if (role==Qt::EditRole && !mIdCollection->getColumn (index.column()).isEditable())
|
if (role==Qt::EditRole && !mIdCollection->getColumn (index.column()).isEditable())
|
||||||
|
@ -52,6 +58,9 @@ QVariant CSMWorld::IdTable::headerData (int section, Qt::Orientation orientation
|
||||||
if (role==ColumnBase::Role_Display)
|
if (role==ColumnBase::Role_Display)
|
||||||
return mIdCollection->getColumn (section).mDisplayType;
|
return mIdCollection->getColumn (section).mDisplayType;
|
||||||
|
|
||||||
|
if (role==ColumnBase::Role_ColumnId)
|
||||||
|
return getColumnId (section);
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue