Port platformsupport to QStringView
Task-number: QTBUG-84319 Change-Id: I8032382904bc8481fe0a147ca38f3de9cfb1890f Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
This commit is contained in:
parent
dd28aaec6f
commit
31828b3d6b
@ -138,9 +138,9 @@ static FontKeys &fontKeys()
|
||||
#if QT_CONFIG(regularexpression)
|
||||
realKey.remove(sizeListMatch);
|
||||
#endif
|
||||
const auto fontNames = QStringRef(&realKey).trimmed().split(QLatin1Char('&'));
|
||||
const auto fontNames = QStringView(realKey).trimmed().split(QLatin1Char('&'));
|
||||
fontKey.fontNames.reserve(fontNames.size());
|
||||
for (const QStringRef &fontName : fontNames)
|
||||
for (const auto &fontName : fontNames)
|
||||
fontKey.fontNames.append(fontName.trimmed().toString());
|
||||
result.append(fontKey);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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"))
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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=")))
|
||||
|
@ -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="))) {
|
||||
|
@ -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());
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user