diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-05-27 12:32:26 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-06-15 10:43:51 +0200 |
commit | 31828b3d6b658ef69faaee1f4d2a06a701967294 (patch) | |
tree | 4b76dda5f78405a44727cd0038e02d4c9646e205 /src/platformsupport | |
parent | dd28aaec6ff062327df7775e976274dc1804dc3f (diff) |
Port platformsupport to QStringView
Task-number: QTBUG-84319
Change-Id: I8032382904bc8481fe0a147ca38f3de9cfb1890f
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
Diffstat (limited to 'src/platformsupport')
8 files changed, 13 insertions, 13 deletions
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp b/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp index 118940c634..96af9a2b47 100644 --- a/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp +++ b/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp @@ -220,7 +220,7 @@ bool QDeviceDiscoveryUDev::checkDeviceType(udev_device *dev) if ((m_types & Device_Keyboard) && (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD"), "1") == 0 )) { const QString capabilities_key = QString::fromUtf8(udev_device_get_sysattr_value(dev, "capabilities/key")); - const auto val = capabilities_key.splitRef(QLatin1Char(' '), Qt::SkipEmptyParts); + const auto val = QStringView{capabilities_key}.split(QLatin1Char(' '), Qt::SkipEmptyParts); if (!val.isEmpty()) { bool ok; unsigned long long keys = val.last().toULongLong(&ok, 16); diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp index de37f5e2df..d951688b4f 100644 --- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp @@ -120,8 +120,8 @@ std::unique_ptr<QEvdevKeyboardHandler> QEvdevKeyboardHandler::create(const QStri bool enableCompose = false; int grab = 0; - const auto args = specification.splitRef(QLatin1Char(':')); - for (const QStringRef &arg : args) { + const auto args = QStringView{specification}.split(QLatin1Char(':')); + for (const auto &arg : args) { if (arg.startsWith(QLatin1String("keymap="))) keymapFile = arg.mid(7).toString(); else if (arg == QLatin1String("disable-zap")) diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp index 52d9c34b1c..7080245d3b 100644 --- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardmanager.cpp @@ -124,8 +124,8 @@ 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; - const auto specs = m_spec.splitRef(QLatin1Char(':')); - for (const QStringRef &arg : specs) { + const auto specs = QStringView{m_spec}.split(QLatin1Char(':')); + for (const auto &arg : specs) { if (arg.startsWith(QLatin1String("keymap="))) keymapFromSpec = arg.mid(7).toString(); } diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp index 0b1c5548c7..5d6f20bd1a 100644 --- a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp +++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp @@ -75,8 +75,8 @@ std::unique_ptr<QEvdevMouseHandler> QEvdevMouseHandler::create(const QString &de int grab = 0; bool abs = false; - const auto args = specification.splitRef(QLatin1Char(':')); - for (const QStringRef &arg : args) { + const auto args = QStringView{specification}.split(QLatin1Char(':')); + for (const auto &arg : args) { if (arg == QLatin1String("nocompress")) compression = false; else if (arg.startsWith(QLatin1String("dejitter="))) diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp index daa52d690e..108d03fac6 100644 --- a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp +++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp @@ -68,7 +68,7 @@ QEvdevMouseManager::QEvdevMouseManager(const QString &key, const QString &specif auto parsed = QEvdevUtil::parseSpecification(spec); m_spec = std::move(parsed.spec); - for (const QStringRef &arg : qAsConst(parsed.args)) { + for (const auto &arg : qAsConst(parsed.args)) { if (arg.startsWith(QLatin1String("xoffset="))) { m_xoffset = arg.mid(8).toInt(); } else if (arg.startsWith(QLatin1String("yoffset="))) { diff --git a/src/platformsupport/input/shared/qevdevutil.cpp b/src/platformsupport/input/shared/qevdevutil.cpp index 74f8bcdc2b..4cecb27a64 100644 --- a/src/platformsupport/input/shared/qevdevutil.cpp +++ b/src/platformsupport/input/shared/qevdevutil.cpp @@ -47,9 +47,9 @@ ParsedSpecification parseSpecification(const QString &specification) { ParsedSpecification result; - result.args = specification.splitRef(QLatin1Char(':')); + result.args = QStringView{specification}.split(QLatin1Char(':')); - for (const QStringRef &arg : qAsConst(result.args)) { + for (const auto &arg : qAsConst(result.args)) { if (arg.startsWith(QLatin1String("/dev/"))) { // if device is specified try to use it result.devices.append(arg.toString()); diff --git a/src/platformsupport/input/shared/qevdevutil_p.h b/src/platformsupport/input/shared/qevdevutil_p.h index 7d0a5af130..d5576f66cd 100644 --- a/src/platformsupport/input/shared/qevdevutil_p.h +++ b/src/platformsupport/input/shared/qevdevutil_p.h @@ -54,7 +54,7 @@ #include <QString> #include <QStringList> #include <QVector> -#include <QStringRef> +#include <QStringView> QT_BEGIN_NAMESPACE @@ -64,7 +64,7 @@ struct ParsedSpecification { QString spec; QStringList devices; - QVector<QStringRef> args; + QVector<QStringView> args; }; ParsedSpecification parseSpecification(const QString &specification); diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp index cb1b39db64..594dec8897 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp @@ -711,7 +711,7 @@ public: { Q_ASSERT(!systemFont); const int split = gtkFontName.lastIndexOf(QChar::Space); - float size = gtkFontName.midRef(split + 1).toFloat(); + float size = QStringView{gtkFontName}.mid(split + 1).toFloat(); QString fontName = gtkFontName.left(split); systemFont = new QFont(fontName, size); |