mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-01 00:45:34 +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."
This commit is contained in:
parent
f029682057
commit
77394fce99
1 changed files with 8 additions and 7 deletions
|
@ -280,12 +280,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)
|
||||
{
|
||||
|
@ -306,6 +300,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()));
|
||||
addAction (mEditAction);
|
||||
|
@ -429,7 +430,7 @@ std::vector<std::string> CSVWorld::Table::getSelectedIds() const
|
|||
QModelIndexList selectedRows = selectionModel()->selectedRows();
|
||||
int columnIndex = mModel->findColumnIndex (CSMWorld::Columns::ColumnId_Id);
|
||||
|
||||
for (QModelIndexList::const_iterator iter (selectedRows.begin());
|
||||
for (QModelIndexList::const_iterator iter (selectedRows.begin());
|
||||
iter != selectedRows.end();
|
||||
++iter)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue