summaryrefslogtreecommitdiff
path: root/src/modlist.cpp
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2015-06-10 21:22:54 +0200
committerTannin <devnull@localhost>2015-06-10 21:22:54 +0200
commitd25a81071c078585f14176283b89e1a6b0ad5795 (patch)
tree002ccfa83c9db52f15dc4c2e919b7d68836f8594 /src/modlist.cpp
parentef9a61886c090e184c042f884687f401e25b1faa (diff)
more generic solution to the problem fixed in changeset bb74f8eb639c, now also applied in another location
Diffstat (limited to 'src/modlist.cpp')
-rw-r--r--src/modlist.cpp19
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;
}