1
0
Fork 0

configure_hotkey: Make IsUsedKey() a const member function

This doesn't actually modify instance state of the dialog, so this can
be made const.
This commit is contained in:
Lioncash 2019-04-09 19:35:52 -04:00 committed by fearlessTobi
parent 46b015befd
commit 35281b4b3b
2 changed files with 4 additions and 4 deletions

View File

@ -35,7 +35,7 @@ void ConfigureHotkeys::EmitHotkeysChanged() {
emit HotkeysChanged(GetUsedKeyList()); emit HotkeysChanged(GetUsedKeyList());
} }
QList<QKeySequence> ConfigureHotkeys::GetUsedKeyList() { QList<QKeySequence> ConfigureHotkeys::GetUsedKeyList() const {
QList<QKeySequence> list; QList<QKeySequence> list;
for (int r = 0; r < model->rowCount(); r++) { for (int r = 0; r < model->rowCount(); r++) {
QStandardItem* parent = model->item(r, 0); QStandardItem* parent = model->item(r, 0);
@ -94,7 +94,7 @@ void ConfigureHotkeys::Configure(QModelIndex index) {
} }
} }
bool ConfigureHotkeys::IsUsedKey(QKeySequence key_sequence) { bool ConfigureHotkeys::IsUsedKey(QKeySequence key_sequence) const {
return input_keys_list.contains(key_sequence) || GetUsedKeyList().contains(key_sequence); return input_keys_list.contains(key_sequence) || GetUsedKeyList().contains(key_sequence);
} }

View File

@ -42,8 +42,8 @@ signals:
private: private:
void Configure(QModelIndex index); void Configure(QModelIndex index);
bool IsUsedKey(QKeySequence key_sequence); bool IsUsedKey(QKeySequence key_sequence) const;
QList<QKeySequence> GetUsedKeyList(); QList<QKeySequence> GetUsedKeyList() const;
std::unique_ptr<Ui::ConfigureHotkeys> ui; std::unique_ptr<Ui::ConfigureHotkeys> ui;