1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-17 10:10:23 +00:00

Fix table being sorted twice (at least it appeared that way according to the sample profiler)

- Quoting Qt-4.8: "Note: . Setting the property to true with setSortingEnabled() immediately triggers a call to sortByColumn() with the current sort section and order."

(copied the changes from commit SHA-1: 77394fce99)
This commit is contained in:
cc9cii 2021-07-23 23:18:11 +10:00
parent 725d689e8a
commit ee3361a118

View File

@ -269,12 +269,6 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id,
setSelectionBehavior (QAbstractItemView::SelectRows);
setSelectionMode (QAbstractItemView::ExtendedSelection);
setSortingEnabled (sorting);
if (sorting)
{
sortByColumn (mModel->findColumnIndex(CSMWorld::Columns::ColumnId_Id), Qt::AscendingOrder);
}
int columns = mModel->columnCount();
for (int i=0; i<columns; ++i)
{
@ -295,6 +289,13 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id,
hideColumn (i);
}
if (sorting)
{
// FIXME: some tables (e.g. CellRef) have this column hidden, which makes it confusing
sortByColumn (mModel->findColumnIndex(CSMWorld::Columns::ColumnId_Id), Qt::AscendingOrder);
}
setSortingEnabled (sorting);
mEditAction = new QAction (tr ("Edit Record"), this);
connect (mEditAction, SIGNAL (triggered()), this, SLOT (editRecord()));
mEditAction->setIcon(QIcon(":edit-edit"));