mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-09 18:40:14 +00:00
Merge remote-tracking branch 'cc9cii/filter-fix'
This commit is contained in:
commit
f3e040b531
@ -21,21 +21,17 @@ void CSMWorld::IdTableProxyModel::updateColumnMap()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSMWorld::IdTableProxyModel::filterAcceptsColumn (int sourceColumn, const QModelIndex& sourceParent)
|
|
||||||
const
|
|
||||||
{
|
|
||||||
int flags =
|
|
||||||
sourceModel()->headerData (sourceColumn, Qt::Horizontal, CSMWorld::ColumnBase::Role_Flags).toInt();
|
|
||||||
|
|
||||||
if (flags & CSMWorld::ColumnBase::Flag_Table)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSMWorld::IdTableProxyModel::filterAcceptsRow (int sourceRow, const QModelIndex& sourceParent)
|
bool CSMWorld::IdTableProxyModel::filterAcceptsRow (int sourceRow, const QModelIndex& sourceParent)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
|
// It is not possible to use filterAcceptsColumn() and check for
|
||||||
|
// sourceModel()->headerData (sourceColumn, Qt::Horizontal, CSMWorld::ColumnBase::Role_Flags)
|
||||||
|
// because the sourceColumn parameter excludes the hidden columns, i.e. wrong columns can
|
||||||
|
// be rejected. Workaround by disallowing tree branches (nested columns), which are not meant
|
||||||
|
// to be visible, from the filter.
|
||||||
|
if (sourceParent.isValid())
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!mFilter)
|
if (!mFilter)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -39,8 +39,6 @@ namespace CSMWorld
|
|||||||
bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
|
bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
|
||||||
|
|
||||||
virtual bool filterAcceptsRow (int sourceRow, const QModelIndex& sourceParent) const;
|
virtual bool filterAcceptsRow (int sourceRow, const QModelIndex& sourceParent) const;
|
||||||
|
|
||||||
virtual bool filterAcceptsColumn (int sourceColumn, const QModelIndex& sourceParent) const;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user