mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 12:58:00 +03:00
Be more careful when we tell Qt that data has changed
Unchecking files only changes whether they're checked, and doesn't completely rearrange the table and change the number of elements it has, so we only need to change the check state, not the whole layout. It's way faster to just query all the data once after setting a content list than it is to query the data for all files between the old and new location of a file when we change any file's location in the load order.
This commit is contained in:
parent
3901084cc2
commit
1237746549
1 changed files with 2 additions and 3 deletions
|
@ -725,7 +725,6 @@ void ContentSelectorModel::ContentModel::setContentList(const QStringList& fileL
|
|||
if (filePosition < previousPosition)
|
||||
{
|
||||
mFiles.move(filePosition, previousPosition);
|
||||
emit dataChanged(index(filePosition, 0, QModelIndex()), index(previousPosition, 0, QModelIndex()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -734,6 +733,7 @@ void ContentSelectorModel::ContentModel::setContentList(const QStringList& fileL
|
|||
}
|
||||
}
|
||||
checkForLoadOrderErrors();
|
||||
emit dataChanged(index(0, 0), index(rowCount(), columnCount()));
|
||||
}
|
||||
|
||||
void ContentSelectorModel::ContentModel::checkForLoadOrderErrors()
|
||||
|
@ -900,7 +900,6 @@ ContentSelectorModel::ContentFileList ContentSelectorModel::ContentModel::checke
|
|||
|
||||
void ContentSelectorModel::ContentModel::uncheckAll()
|
||||
{
|
||||
emit layoutAboutToBeChanged();
|
||||
mCheckedFiles.clear();
|
||||
emit layoutChanged();
|
||||
emit dataChanged(index(0, 0), index(rowCount(), columnCount()), { Qt::CheckStateRole, Qt::UserRole + 1 });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue