mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
hide type column in non-mixed type tables
This commit is contained in:
parent
faa5ef0874
commit
f95e72166c
2 changed files with 17 additions and 10 deletions
|
@ -78,7 +78,7 @@ namespace CSMWorld
|
|||
{
|
||||
int mType;
|
||||
|
||||
FixedRecordTypeColumn (int type) : Column<ESXRecordT> ("Type"), mType (type) {}
|
||||
FixedRecordTypeColumn (int type) : Column<ESXRecordT> ("Type", 0), mType (type) {}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
|
|
|
@ -84,15 +84,6 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id, CSMWorld::Data& data, Q
|
|||
{
|
||||
mModel = &dynamic_cast<CSMWorld::IdTable&> (*data.getTableModel (id));
|
||||
|
||||
int columns = mModel->columnCount();
|
||||
|
||||
for (int i=0; i<columns; ++i)
|
||||
{
|
||||
CommandDelegate *delegate = new CommandDelegate (undoStack, this);
|
||||
mDelegates.push_back (delegate);
|
||||
setItemDelegateForColumn (i, delegate);
|
||||
}
|
||||
|
||||
mProxyModel = new CSMWorld::IdTableProxyModel (this);
|
||||
mProxyModel->setSourceModel (mModel);
|
||||
|
||||
|
@ -103,6 +94,22 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id, CSMWorld::Data& data, Q
|
|||
setSelectionBehavior (QAbstractItemView::SelectRows);
|
||||
setSelectionMode (QAbstractItemView::ExtendedSelection);
|
||||
|
||||
int columns = mModel->columnCount();
|
||||
|
||||
for (int i=0; i<columns; ++i)
|
||||
{
|
||||
int flags = mModel->headerData (i, Qt::Horizontal, CSMWorld::ColumnBase::Role_Flags).toInt();
|
||||
|
||||
if (flags & CSMWorld::ColumnBase::Flag_Table)
|
||||
{
|
||||
CommandDelegate *delegate = new CommandDelegate (undoStack, this);
|
||||
mDelegates.push_back (delegate);
|
||||
setItemDelegateForColumn (i, delegate);
|
||||
}
|
||||
else
|
||||
hideColumn (i);
|
||||
}
|
||||
|
||||
/// \todo make initial layout fill the whole width of the table
|
||||
|
||||
if (createAndDelete)
|
||||
|
|
Loading…
Reference in a new issue