make modification column optional in table views

This commit is contained in:
Marc Zinnschlag 2014-07-05 15:50:17 +02:00
parent 4f6c7b0e84
commit 42db9a5091

View file

@ -425,21 +425,27 @@ void CSVWorld::Table::tableSizeUpdate()
{ {
int rows = mProxyModel->rowCount(); int rows = mProxyModel->rowCount();
for (int i=0; i<rows; ++i) int columnIndex = mModel->searchColumnIndex (CSMWorld::Columns::ColumnId_Modification);
if (columnIndex!=-1)
{ {
QModelIndex index = mProxyModel->mapToSource (mProxyModel->index (i, 0)); for (int i=0; i<rows; ++i)
int columnIndex = mModel->findColumnIndex (CSMWorld::Columns::ColumnId_Modification);
int state = mModel->data (mModel->index (index.row(), columnIndex)).toInt();
switch (state)
{ {
case CSMWorld::RecordBase::State_BaseOnly: ++size; break; QModelIndex index = mProxyModel->mapToSource (mProxyModel->index (i, 0));
case CSMWorld::RecordBase::State_Modified: ++size; ++modified; break;
case CSMWorld::RecordBase::State_ModifiedOnly: ++size; ++modified; break; int state = mModel->data (mModel->index (index.row(), columnIndex)).toInt();
case CSMWorld::RecordBase:: State_Deleted: ++deleted; ++modified; break;
switch (state)
{
case CSMWorld::RecordBase::State_BaseOnly: ++size; break;
case CSMWorld::RecordBase::State_Modified: ++size; ++modified; break;
case CSMWorld::RecordBase::State_ModifiedOnly: ++size; ++modified; break;
case CSMWorld::RecordBase:: State_Deleted: ++deleted; ++modified; break;
}
} }
} }
else
size = rows;
} }
tableSizeChanged (size, deleted, modified); tableSizeChanged (size, deleted, modified);