From f59f52501c1f4bf160075dc4439f5af883f730e1 Mon Sep 17 00:00:00 2001 From: TheBloke Date: Sun, 13 Jul 2014 15:45:19 +0100 Subject: savegameList: more minor changes - Context Menu - can do same job with fewer variables and assignments - deleteSaveGame_clicked - const reference, not new value, in foreach loop --- src/mainwindow.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 1baf60d4..aed95616 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3890,7 +3890,7 @@ void MainWindow::deleteSavegame_clicked() QRegExp saveSuffix(".ess$"); QStringList deleteFiles; - foreach (QModelIndex idx, selectedIndexes) { + foreach (const QModelIndex &idx, selectedIndexes) { QString name = idx.data().toString(); SaveGame *save = new SaveGame(this, idx.data(Qt::UserRole).toString()); @@ -4007,15 +4007,11 @@ void MainWindow::fixMods_clicked() void MainWindow::on_savegameList_customContextMenuRequested(const QPoint &pos) { QItemSelectionModel *selection = ui->savegameList->selectionModel(); - QModelIndexList selectedIndexes = selection->selectedIndexes(); - bool multipleSelected = false; - int selectedCount = selectedIndexes.count(); - - if ( !selection->hasSelection()) { + if (!selection->hasSelection()) return; - } else if (selectedCount > 1) - multipleSelected = true; + + bool multipleSelected = (selection->selectedIndexes().count() > 1); QMenu menu; -- cgit v1.3.1