From d42da86c96cfef54f88b5897a76fb26044e4d449 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Fri, 1 Apr 2016 14:17:51 +0300 Subject: OpenGL, PlatformSupport: use QStringRef to optimize memory allocation Replace substring functions that return QString with corresponding functions that return QStringRef where it's possible. Create QString from QStringRef only where necessary. While touching the code, also port loops to C++11 style. Change-Id: Ib94d29b6ecec1cdab2604d0277a743e8b340be5e Reviewed-by: Marc Mutz --- src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp') diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp index 178578e5a2..ffe9f82325 100644 --- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp @@ -135,9 +135,10 @@ void QEvdevKeyboardManager::loadKeymap(const QString &file) // Restore the default, which is either the built-in keymap or // the one given in the plugin spec. QString keymapFromSpec; - foreach (const QString &arg, m_spec.split(QLatin1Char(':'))) { + const auto specs = m_spec.splitRef(QLatin1Char(':')); + for (const QStringRef &arg : specs) { if (arg.startsWith(QLatin1String("keymap="))) - keymapFromSpec = arg.mid(7); + keymapFromSpec = arg.mid(7).toString(); } foreach (QEvdevKeyboardHandler *handler, m_keyboards) { if (keymapFromSpec.isEmpty()) -- cgit v1.2.3