summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2020-12-28 03:37:20 -0500
committerisanae <14251494+isanae@users.noreply.github.com>2020-12-28 03:37:20 -0500
commit3c62a048da24ae58d5d9d490914ba9e8dbdc89f0 (patch)
treec3bb4987f2f09868e234b87c44025be0d0803590 /src
parent1be20063595206d42ec95a5028b8ecf8f7567476 (diff)
fixed crash for ignore data/mark converted on multiple mods
also fixes only half the selected items being handled at a time the selection must be copied first because it's live and will get invalidated when filters are being used there was some weird connect() calls for every item, not sure why
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp40
1 files changed, 25 insertions, 15 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index ce1dc3d1..6c3801da 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -3118,41 +3118,51 @@ void MainWindow::displayModInformation(int row, ModInfoTabIDs tabID)
void MainWindow::ignoreMissingData_clicked()
{
- QItemSelectionModel *selection = ui->modList->selectionModel();
- if (selection->hasSelection() && selection->selectedRows().count() > 1) {
- for (QModelIndex idx : selection->selectedRows()) {
+ const auto rows = ui->modList->selectionModel()->selectedRows();
+
+ if (rows.count() > 1) {
+ std::vector<ModInfo::Ptr> changed;
+
+ for (QModelIndex idx : rows) {
int row_idx = idx.data(Qt::UserRole + 1).toInt();
ModInfo::Ptr info = ModInfo::getByIndex(row_idx);
info->markValidated(true);
- connect(this, SIGNAL(modListDataChanged(QModelIndex, QModelIndex)), m_OrganizerCore.modList(), SIGNAL(dataChanged(QModelIndex, QModelIndex)));
+ changed.push_back(info);
+ }
- emit modListDataChanged(m_OrganizerCore.modList()->index(row_idx, 0), m_OrganizerCore.modList()->index(row_idx, m_OrganizerCore.modList()->columnCount() - 1));
+ for (auto&& m : changed) {
+ int row_idx = ModInfo::getIndex(m->internalName());
+ m_OrganizerCore.modList()->notifyChange(row_idx);
}
} else {
ModInfo::Ptr info = ModInfo::getByIndex(m_ContextRow);
info->markValidated(true);
- connect(this, SIGNAL(modListDataChanged(QModelIndex, QModelIndex)), m_OrganizerCore.modList(), SIGNAL(dataChanged(QModelIndex, QModelIndex)));
-
- emit modListDataChanged(m_OrganizerCore.modList()->index(m_ContextRow, 0), m_OrganizerCore.modList()->index(m_ContextRow, m_OrganizerCore.modList()->columnCount() - 1));
+ m_OrganizerCore.modList()->notifyChange(m_ContextRow);
}
}
void MainWindow::markConverted_clicked()
{
- QItemSelectionModel *selection = ui->modList->selectionModel();
- if (selection->hasSelection() && selection->selectedRows().count() > 1) {
- for (QModelIndex idx : selection->selectedRows()) {
+ const auto rows = ui->modList->selectionModel()->selectedRows();
+
+ if (rows.count() > 1) {
+ std::vector<ModInfo::Ptr> changed;
+
+ for (QModelIndex idx : rows) {
int row_idx = idx.data(Qt::UserRole + 1).toInt();
ModInfo::Ptr info = ModInfo::getByIndex(row_idx);
info->markConverted(true);
- connect(this, SIGNAL(modListDataChanged(QModelIndex, QModelIndex)), m_OrganizerCore.modList(), SIGNAL(dataChanged(QModelIndex, QModelIndex)));
- emit modListDataChanged(m_OrganizerCore.modList()->index(row_idx, 0), m_OrganizerCore.modList()->index(row_idx, m_OrganizerCore.modList()->columnCount() - 1));
+ changed.push_back(info);
+ }
+
+ for (auto&& m : changed) {
+ int row_idx = ModInfo::getIndex(m->internalName());
+ m_OrganizerCore.modList()->notifyChange(row_idx);
}
} else {
ModInfo::Ptr info = ModInfo::getByIndex(m_ContextRow);
info->markConverted(true);
- connect(this, SIGNAL(modListDataChanged(QModelIndex, QModelIndex)), m_OrganizerCore.modList(), SIGNAL(dataChanged(QModelIndex, QModelIndex)));
- emit modListDataChanged(m_OrganizerCore.modList()->index(m_ContextRow, 0), m_OrganizerCore.modList()->index(m_ContextRow, m_OrganizerCore.modList()->columnCount() - 1));
+ m_OrganizerCore.modList()->notifyChange(m_ContextRow);
}
}