keyboard: change the function to use
authorJinhyung Jo <jinhyung.jo@samsung.com>
Fri, 4 Nov 2016 02:46:47 +0000 (11:46 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Tue, 8 Nov 2016 02:49:43 +0000 (11:49 +0900)
QMap::take(const Key &key) is more efficient.
Short description for take():
  "Removes the item with the key from the map
   and returns the value associated with it."
For more information, see 'http://doc.qt.io/qt-5/qmap.html#take'.
And the value function is a constant function.

Change-Id: Ibdaf578c6eef49ebfa8beb3a00fc61785e4b74ed
Signed-off-by: Jinhyung Jo <jinhyung.jo@samsung.com>
tizen/src/ui/input/keyboardshortcut.cpp

index c14f2cf..a5f598c 100644 (file)
@@ -87,11 +87,10 @@ void KeyboardShortcut::registerHwKeyShortcuts(QList<HardwareKey *> &list)
 void KeyboardShortcut::cancelHwKeyShortcuts(QList<HardwareKey *> &list)
 {
     for (int index = 0; index < list.count(); index++) {
-        delete hwKeyShortcutMap.value(list.at(index));
-        hwKeyShortcutMap.remove(list.at(index));
+        delete hwKeyShortcutMap.take(list.at(index));
     }
 
-    qDebug() << hwKeyShortcutMap.count() << "shortcuts have been registered";
+    qDebug() << hwKeyShortcutMap.count() << "shortcuts have been unregistered";
 }
 
 void KeyboardShortcut::slotHwKeyShortcut(int keycode)