Skip to content

Commit 52b3e06

Browse files
committed
Merge branch 'refreshmodel' into 'master'
Fix out-of-bounds index dataChanged calls See merge request OpenMW/openmw!4677
2 parents 6d97ea0 + 54eea09 commit 52b3e06

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

components/contentselector/model/contentmodel.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ void ContentSelectorModel::ContentModel::setContentList(const QStringList& fileL
726726
}
727727
}
728728
}
729-
emit dataChanged(index(0, 0), index(rowCount(), columnCount()));
729+
refreshModel();
730730
}
731731

732732
QList<ContentSelectorModel::LoadOrderError> ContentSelectorModel::ContentModel::checkForLoadOrderErrors(
@@ -790,9 +790,9 @@ QString ContentSelectorModel::ContentModel::toolTip(const EsmFile* file) const
790790
}
791791
}
792792

793-
void ContentSelectorModel::ContentModel::refreshModel()
793+
void ContentSelectorModel::ContentModel::refreshModel(std::initializer_list<int> roles)
794794
{
795-
emit dataChanged(index(0, 0), index(rowCount() - 1, 0));
795+
emit dataChanged(index(0, 0), index(rowCount() - 1, 0), roles);
796796
}
797797

798798
bool ContentSelectorModel::ContentModel::setCheckState(const QString& filepath, bool checkState)
@@ -878,5 +878,5 @@ ContentSelectorModel::ContentFileList ContentSelectorModel::ContentModel::checke
878878
void ContentSelectorModel::ContentModel::uncheckAll()
879879
{
880880
mCheckedFiles.clear();
881-
emit dataChanged(index(0, 0), index(rowCount(), columnCount()), { Qt::CheckStateRole, Qt::UserRole + 1 });
881+
refreshModel({ Qt::CheckStateRole, Qt::UserRole + 1 });
882882
}

components/contentselector/model/contentmodel.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ namespace ContentSelectorModel
6767
ContentFileList checkedItems() const;
6868
void uncheckAll();
6969

70-
void refreshModel();
70+
void refreshModel(std::initializer_list<int> roles = {});
7171

7272
private:
7373
void addFile(EsmFile* file);

0 commit comments

Comments
 (0)