From 12377465499100699f6148d6378992d4c39db226 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Sun, 6 Apr 2025 01:31:05 +0100 Subject: [PATCH] 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. --- components/contentselector/model/contentmodel.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/contentselector/model/contentmodel.cpp b/components/contentselector/model/contentmodel.cpp index fe26d37b97..d7222f92f3 100644 --- a/components/contentselector/model/contentmodel.cpp +++ b/components/contentselector/model/contentmodel.cpp @@ -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 }); }