summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Hindenburg <[email protected]>2016-06-20 09:40:58 -0400
committerKurt Hindenburg <[email protected]>2016-06-20 09:40:58 -0400
commitdd1cc980646f34fb10fdb97ef3aca793526866ab (patch)
tree53210f221de2aa82e88a3c47be978749b21c7f01
parent5c28ba05c6b49bcf331cd56c16ae1c6d43322de8 (diff)
Fix foreach clazy-container-anti-pattern issue
-rw-r--r--src/KeyboardTranslator.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/KeyboardTranslator.cpp b/src/KeyboardTranslator.cpp
index bcbc95e..3effb72 100644
--- a/src/KeyboardTranslator.cpp
+++ b/src/KeyboardTranslator.cpp
@@ -677,9 +677,12 @@ void KeyboardTranslator::removeEntry(const Entry& entry)
KeyboardTranslator::Entry KeyboardTranslator::findEntry(int keyCode, Qt::KeyboardModifiers modifiers, States state) const
{
- foreach(const Entry & entry, _entries.values(keyCode)) {
- if (entry.matches(keyCode, modifiers, state))
- return entry;
+ QHash<int, KeyboardTranslator::Entry>::const_iterator i = _entries.find(keyCode);
+ while (i != _entries.constEnd() && i.key() == keyCode) {
+ if (i.value().matches(keyCode, modifiers, state)) {
+ return i.value();
+ }
+ ++i;
}
return Entry(); // No matching entry