From 1e31fe896524513577911e382897b841e40a4814 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sat, 7 Sep 2019 22:08:54 +0000 Subject: removed foreach macro git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@9067 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/General/hotkey/settingsdialog.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/plugins/General/hotkey/settingsdialog.cpp') diff --git a/src/plugins/General/hotkey/settingsdialog.cpp b/src/plugins/General/hotkey/settingsdialog.cpp index 7a5bd612d..1255790e2 100644 --- a/src/plugins/General/hotkey/settingsdialog.cpp +++ b/src/plugins/General/hotkey/settingsdialog.cpp @@ -75,7 +75,7 @@ void SettingsDialog::accept() { QSettings settings(Qmmp::configFile(), QSettings::IniFormat); settings.beginGroup("Hotkey"); - foreach(Hotkey *k, m_hotkeys) + for(const Hotkey *k : qAsConst(m_hotkeys)) { settings.setValue(QString("key_%1").arg(k->action), k->key); settings.setValue(QString("modifiers_%1").arg(k->action), k->mod); @@ -86,16 +86,19 @@ void SettingsDialog::accept() void SettingsDialog::on_tableWidget_itemDoubleClicked (QTableWidgetItem *item) { - Hotkey *k = nullptr; - foreach(k, m_hotkeys) + Hotkey *key = nullptr; + for(Hotkey *k : m_hotkeys) { if (k->action == item->type()) + { + key = k; break; + } } - if (!k) + if (!key) return; - HotkeyDialog *dialog = new HotkeyDialog(k->key, k->mod, this); + HotkeyDialog *dialog = new HotkeyDialog(key->key, key->mod, this); if (item->type() >= QTableWidgetItem::UserType && dialog->exec() == QDialog::Accepted) { @@ -104,8 +107,8 @@ void SettingsDialog::on_tableWidget_itemDoubleClicked (QTableWidgetItem *item) if(keyString.isEmpty() || items.isEmpty() || items.first() == item) { item->setText(keyString); - k->key = dialog->keySym (); - k->mod = dialog->nativeModifiers (); + key->key = dialog->keySym (); + key->mod = dialog->nativeModifiers (); } else QMessageBox::warning(this, tr("Warning"), tr("Key sequence '%1' is already used").arg(keyString)); -- cgit v1.2.3-13-gbd6f