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>
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)