mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
Initially fill hotkey settings component from settings
When the component was constructed, the table view with configured hotkeys was empty even if hotkeys were configured. This commit reloads the configured settings during component construction and populates the table.
This commit is contained in:
committed by
Mathew Sutcliffe
parent
c6bfd3b01d
commit
9515109719
@@ -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");
|
||||
|
||||
@@ -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::CSettingsHotkeyComponent> ui;
|
||||
BlackGui::Models::CActionHotkeyListModel m_model;
|
||||
|
||||
Reference in New Issue
Block a user