aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlstringconverters.cpp
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@qt.io>2020-06-16 10:23:19 +0200
committerKarsten Heimrich <karsten.heimrich@qt.io>2020-06-16 22:46:16 +0200
commit1b10ce6a08edbc2ac7e8fd7e97e3fc691f2081df (patch)
tree34ab485d1dd9435369709b5e77c11af6dec78c22 /src/qml/qml/qqmlstringconverters.cpp
parentb65eee039092fa664e781cdd98a4bb5e66815218 (diff)
Port QtDeclarative from QStringRef to QStringView
Task-number: QTBUG-84319 Change-Id: I2dcfb8a2db98282c7a1acdad1e6f4f949f26df15 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlstringconverters.cpp')
-rw-r--r--src/qml/qml/qqmlstringconverters.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/qml/qml/qqmlstringconverters.cpp b/src/qml/qml/qqmlstringconverters.cpp
index e53f90b45b..d1c7d8cdf3 100644
--- a/src/qml/qml/qqmlstringconverters.cpp
+++ b/src/qml/qml/qqmlstringconverters.cpp
@@ -143,8 +143,8 @@ QPointF QQmlStringConverters::pointFFromString(const QString &s, bool *ok)
bool xGood, yGood;
int index = s.indexOf(QLatin1Char(','));
- qreal xCoord = s.leftRef(index).toDouble(&xGood);
- qreal yCoord = s.midRef(index+1).toDouble(&yGood);
+ qreal xCoord = QStringView{s}.left(index).toDouble(&xGood);
+ qreal yCoord = QStringView{s}.mid(index+1).toDouble(&yGood);
if (!xGood || !yGood) {
if (ok)
*ok = false;
@@ -167,8 +167,8 @@ QSizeF QQmlStringConverters::sizeFFromString(const QString &s, bool *ok)
bool wGood, hGood;
int index = s.indexOf(QLatin1Char('x'));
- qreal width = s.leftRef(index).toDouble(&wGood);
- qreal height = s.midRef(index+1).toDouble(&hGood);
+ qreal width = QStringView{s}.left(index).toDouble(&wGood);
+ qreal height = QStringView{s}.mid(index+1).toDouble(&hGood);
if (!wGood || !hGood) {
if (ok)
*ok = false;
@@ -191,12 +191,12 @@ QRectF QQmlStringConverters::rectFFromString(const QString &s, bool *ok)
bool xGood, yGood, wGood, hGood;
int index = s.indexOf(QLatin1Char(','));
- qreal x = s.leftRef(index).toDouble(&xGood);
+ qreal x = QStringView{s}.left(index).toDouble(&xGood);
int index2 = s.indexOf(QLatin1Char(','), index+1);
- qreal y = s.midRef(index+1, index2-index-1).toDouble(&yGood);
+ qreal y = QStringView{s}.mid(index+1, index2-index-1).toDouble(&yGood);
index = s.indexOf(QLatin1Char('x'), index2+1);
- qreal width = s.midRef(index2+1, index-index2-1).toDouble(&wGood);
- qreal height = s.midRef(index+1).toDouble(&hGood);
+ qreal width = QStringView{s}.mid(index2+1, index-index2-1).toDouble(&wGood);
+ qreal height = QStringView{s}.mid(index+1).toDouble(&hGood);
if (!xGood || !yGood || !wGood || !hGood) {
if (ok)
*ok = false;