diff options
Diffstat (limited to 'src/modlist.cpp')
| -rw-r--r-- | src/modlist.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/modlist.cpp b/src/modlist.cpp index a7990132..df006e30 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -453,6 +453,8 @@ bool ModList::setData(const QModelIndex &index, const QVariant &value, int role) bool result = false;
+ emit aboutToChangeData();
+
if (role == Qt::CheckStateRole) {
bool enabled = value.toInt() == Qt::Checked;
if (m_Profile->modEnabled(modID) != enabled) {
@@ -512,6 +514,8 @@ bool ModList::setData(const QModelIndex &index, const QVariant &value, int role) }
}
+ emit postDataChanged();
+
IModList::ModStates newState = state(modID);
if (oldState != newState) {
try {
@@ -1091,16 +1095,7 @@ bool ModList::deleteSelection(QAbstractItemView *itemView) bool ModList::toggleSelection(QAbstractItemView *itemView)
{
- QAbstractItemModel *model = itemView->model();
-
- // having a filter active when dataChanged is called caused a crash
- // (at least with some Qt versions)
- ModListSortProxy *filterModel = qobject_cast<ModListSortProxy*>(model);
- std::vector<int> filter;
- if (filterModel != nullptr) {
- filter = filterModel->categoryFilter();
- filterModel->setCategoryFilter(std::vector<int>());
- }
+ emit aboutToChangeData();
QItemSelectionModel *selectionModel = itemView->selectionModel();
@@ -1115,9 +1110,7 @@ bool ModList::toggleSelection(QAbstractItemView *itemView) emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
- if (filterModel != nullptr) {
- filterModel->setCategoryFilter(filter);
- }
+ emit postDataChanged();
return true;
}
|
