diff --git a/src/blackgui/components/settingshotkeycomponent.cpp b/src/blackgui/components/settingshotkeycomponent.cpp index 10fc23a59..871d6be47 100644 --- a/src/blackgui/components/settingshotkeycomponent.cpp +++ b/src/blackgui/components/settingshotkeycomponent.cpp @@ -48,6 +48,7 @@ namespace BlackGui connect(ui->pb_editHotkey, &QPushButton::clicked, this, &CSettingsHotkeyComponent::ps_editEntry); connect(ui->pb_removeHotkey, &QPushButton::clicked, this, &CSettingsHotkeyComponent::ps_removeEntry); + reloadHotkeysFromSettings(); ui->tv_hotkeys->selectRow(0); } @@ -149,6 +150,19 @@ namespace BlackGui return true; } + void CSettingsHotkeyComponent::reloadHotkeysFromSettings() + { + const CActionHotkeyList hotkeys = m_actionHotkeys.getThreadLocal(); + m_model.clear(); + for (const auto &hotkey : hotkeys) + { + int position = m_model.rowCount(); + m_model.insertRows(position, 1, QModelIndex()); + QModelIndex index = m_model.index(position, 0, QModelIndex()); + m_model.setData(index, QVariant::fromValue(hotkey), CActionHotkeyListModel::ActionHotkeyRole); + } + } + void CSettingsHotkeyComponent::ps_hotkeySlot(bool keyDown) { if (keyDown) QMessageBox::information(this, "Test", "Push-To-Talk"); diff --git a/src/blackgui/components/settingshotkeycomponent.h b/src/blackgui/components/settingshotkeycomponent.h index b917cb721..8d1f809bc 100644 --- a/src/blackgui/components/settingshotkeycomponent.h +++ b/src/blackgui/components/settingshotkeycomponent.h @@ -55,6 +55,7 @@ namespace BlackGui void updateHotkeyInSettings(const BlackMisc::Input::CActionHotkey &oldValue, const BlackMisc::Input::CActionHotkey &newValue); void removeHotkeyFromSettings(const BlackMisc::Input::CActionHotkey &actionHotkey); bool checkAndConfirmConflicts(const BlackMisc::Input::CActionHotkey &actionHotkey, const BlackMisc::Input::CActionHotkeyList &ignore = {}); + void reloadHotkeysFromSettings(); QScopedPointer ui; BlackGui::Models::CActionHotkeyListModel m_model;