diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2019-09-07 22:08:54 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2019-09-07 22:08:54 +0000 |
| commit | 1e31fe896524513577911e382897b841e40a4814 (patch) | |
| tree | 153483337dcab82e0bc32cc19f7876a7eb9593c7 /src/plugins/General/hotkey/settingsdialog.cpp | |
| parent | 1d6f69e20769d902a70001277199129361d0a761 (diff) | |
| download | qmmp-1e31fe896524513577911e382897b841e40a4814.tar.gz qmmp-1e31fe896524513577911e382897b841e40a4814.tar.bz2 qmmp-1e31fe896524513577911e382897b841e40a4814.zip | |
removed foreach macro
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@9067 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/General/hotkey/settingsdialog.cpp')
| -rw-r--r-- | src/plugins/General/hotkey/settingsdialog.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
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)); |
