Port away from deprecated foreach, use for-range instead, first take

The code compiles and konsole loads and seems to work as before.
This commit is contained in:
Ahmad Samir
2019-11-23 18:41:57 +02:00
parent 59ff5d3730
commit c83bb19a68
13 changed files with 55 additions and 51 deletions

View File

@@ -123,8 +123,8 @@ void KeyBindingEditor::filterRows(const QString &text)
void KeyBindingEditor::removeSelectedEntry()
{
QList<QTableWidgetItem *> uniqueList;
foreach (QTableWidgetItem *item, _ui->keyBindingTable->selectedItems()) {
const QList<QTableWidgetItem *> selectedItems = _ui->keyBindingTable->selectedItems();
for (QTableWidgetItem *item : selectedItems) {
if (item->column() == 1) { //Select item at the first column
item = _ui->keyBindingTable->item(item->row(), 0);
}
@@ -134,7 +134,7 @@ void KeyBindingEditor::removeSelectedEntry()
}
}
foreach (QTableWidgetItem *item, uniqueList) {
for (QTableWidgetItem *item : qAsConst(uniqueList)) {
// get the first item in the row which has the entry
KeyboardTranslator::Entry existing = item->data(Qt::UserRole).