void CSVWorld::Table::tableSizeUpdate() { int size = 0; int deleted = 0; int modified = 0; if (mProxyModel->columnCount()>0) { int rows = mProxyModel->rowCount(); for (int i=0; i<rows; ++i) { QModelIndex index = mProxyModel->mapToSource (mProxyModel->index (i, 0)); 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; case CSMWorld::RecordBase::State_Modified: ++size; ++modified; break; case CSMWorld::RecordBase::State_ModifiedOnly: ++size; ++modified; break; case CSMWorld::RecordBase:: State_Deleted: ++deleted; ++modified; break; } } } tableSizeChanged (size, deleted, modified); }
void CSVWorld::Table::tableSizeUpdate() { int size = 0; int deleted = 0; int modified = 0; if (mModel->columnCount()>0) { int rows = mModel->rowCount(); for (int i=0; i<rows; ++i) { QModelIndex index = mProxyModel->mapToSource (mProxyModel->index (i, 0)); /// \todo Do not use hardcoded column numbers int state = mModel->data (mModel->index (index.row(), 1)).toInt(); 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; } } } tableSizeChanged (size, deleted, modified); }
void CSVWorld::Table::tableSizeUpdate() { int size = 0; int deleted = 0; int modified = 0; if (mProxyModel->columnCount()>0) { int rows = mProxyModel->rowCount(); int columnIndex = mModel->searchColumnIndex (CSMWorld::Columns::ColumnId_Modification); if (columnIndex!=-1) { for (int i=0; i<rows; ++i) { QModelIndex index = mProxyModel->mapToSource (mProxyModel->index (i, 0)); int state = mModel->data (mModel->index (index.row(), columnIndex)).toInt(); 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; } emit tableSizeChanged (size, deleted, modified); // not really related to tableSizeUpdate() but placed here for convenience rather than // creating a bunch of extra connections & slot mProxyModel->refreshFilter(); }