[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [wacomtablet] src/tabletfinder: Fix reading of button mapping in tabletfinder
From:       Valeriy Malov <null () kde ! org>
Date:       2018-09-20 18:40:43
Message-ID: E1g33sZ-00040g-P5 () code ! kde ! org
[Download RAW message or body]

Git commit c2be24a66d47add15143d3df72fc60964d0ccab2 by Valeriy Malov.
Committed on 20/09/2018 at 16:26.
Pushed by valeriymalov into branch 'master'.

Fix reading of button mapping in tabletfinder

Use of replace could overwrite previously inserted values

M  +5    -7    src/tabletfinder/dialog.cpp

https://commits.kde.org/wacomtablet/c2be24a66d47add15143d3df72fc60964d0ccab2

diff --git a/src/tabletfinder/dialog.cpp b/src/tabletfinder/dialog.cpp
index 5c4014a..75fe7e4 100644
--- a/src/tabletfinder/dialog.cpp
+++ b/src/tabletfinder/dialog.cpp
@@ -193,13 +193,11 @@ void Dialog::refreshTabletList()
                 t.hwMapping << i;
             }
 
-            QMapIterator<QString, QString> i(ti.getButtonMap());
-            while (i.hasNext()) {
-                i.next();
-                int b = i.key().toInt();
-                int k = i.value().toInt();
-                if(b < t.hwMapping.size()) {
-                    t.hwMapping.replace(b-1,k);
+            const auto buttonMap = ti.getButtonMap();
+            for (const auto key : buttonMap.keys()) {
+                const auto keyIndex = key.toInt() - 1;
+                if (keyIndex < t.buttonNumber) {
+                    t.hwMapping[keyIndex] = buttonMap.value(key).toInt();
                 }
             }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic