aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/auto/qml/qmllint/data/stringLength.qml9
-rw-r--r--tests/auto/qml/qmllint/tst_qmllint.cpp1
-rw-r--r--tools/qmllint/checkidentifiers.cpp2
3 files changed, 11 insertions, 1 deletions
diff --git a/tests/auto/qml/qmllint/data/stringLength.qml b/tests/auto/qml/qmllint/data/stringLength.qml
new file mode 100644
index 0000000000..354fed7b22
--- /dev/null
+++ b/tests/auto/qml/qmllint/data/stringLength.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.15
+
+TextInput {
+ id: textInput
+
+ Component.onCompleted: {
+ console.log("text.length", textInput.text.length);
+ }
+}
diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp
index ca2258dfeb..aba0ad34da 100644
--- a/tests/auto/qml/qmllint/tst_qmllint.cpp
+++ b/tests/auto/qml/qmllint/tst_qmllint.cpp
@@ -385,6 +385,7 @@ void TestQmllint::cleanQmlCode_data()
QTest::newRow("externalEnumProperty") << QStringLiteral("externalEnumProperty.qml");
QTest::newRow("shapes") << QStringLiteral("shapes.qml");
QTest::newRow("var") << QStringLiteral("var.qml");
+ QTest::newRow("stringLength") << QStringLiteral("stringLength.qml");
}
void TestQmllint::cleanQmlCode()
diff --git a/tools/qmllint/checkidentifiers.cpp b/tools/qmllint/checkidentifiers.cpp
index b0c56bcec6..5136242059 100644
--- a/tools/qmllint/checkidentifiers.cpp
+++ b/tools/qmllint/checkidentifiers.cpp
@@ -166,7 +166,7 @@ bool CheckIdentifiers::checkMemberAccess(const QVector<FieldMember> &members,
continue;
}
- if (typeName == QLatin1String("string")) {
+ if (typeName == QLatin1String("QString")) {
detectedRestrictiveKind = typeName;
detectedRestrictiveName = access.m_name;
expectedNext.append(QLatin1String("length"));