aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/auto/qml/qmllint/data/InfoItemTextEdit.qml12
-rw-r--r--tests/auto/qml/qmllint/data/stringLength3.qml8
-rw-r--r--tests/auto/qml/qmllint/tst_qmllint.cpp1
-rw-r--r--tools/qmllint/checkidentifiers.cpp3
4 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qml/qmllint/data/InfoItemTextEdit.qml b/tests/auto/qml/qmllint/data/InfoItemTextEdit.qml
new file mode 100644
index 0000000000..be2d35d574
--- /dev/null
+++ b/tests/auto/qml/qmllint/data/InfoItemTextEdit.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.11
+import QtQuick.Window 2.3
+
+Rectangle {
+ property color textStrColor: "steelblue"
+ property alias valueStr: input.text
+
+ TextInput {
+ id: input
+ }
+
+}
diff --git a/tests/auto/qml/qmllint/data/stringLength3.qml b/tests/auto/qml/qmllint/data/stringLength3.qml
new file mode 100644
index 0000000000..292a163145
--- /dev/null
+++ b/tests/auto/qml/qmllint/data/stringLength3.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.11
+import QtQuick.Window 2.3
+
+Item {
+ InfoItemTextEdit {
+ textStrColor: valueStr.length === 0 ? "#f5a71e" : "#f5a715"
+ }
+}
diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp
index c7a9358e9f..126abdc9f4 100644
--- a/tests/auto/qml/qmllint/tst_qmllint.cpp
+++ b/tests/auto/qml/qmllint/tst_qmllint.cpp
@@ -622,6 +622,7 @@ void TestQmllint::cleanQmlCode_data()
QTest::newRow("compositeSingleton") << QStringLiteral("compositesingleton.qml");
QTest::newRow("stringLength") << QStringLiteral("stringLength.qml");
QTest::newRow("stringLength2") << QStringLiteral("stringLength2.qml");
+ QTest::newRow("stringLength3") << QStringLiteral("stringLength3.qml");
}
void TestQmllint::cleanQmlCode()
diff --git a/tools/qmllint/checkidentifiers.cpp b/tools/qmllint/checkidentifiers.cpp
index 911e08034a..208f44e51b 100644
--- a/tools/qmllint/checkidentifiers.cpp
+++ b/tools/qmllint/checkidentifiers.cpp
@@ -81,6 +81,9 @@ void CheckIdentifiers::checkMemberAccess(const QVector<FieldMember> &members,
if (prop != nullptr && prop->isList()) {
detectedRestrictiveKind = QLatin1String("list");
expectedNext.append(QLatin1String("length"));
+ } else if (outerScope->internalName() == QLatin1String("QString")) {
+ detectedRestrictiveKind = QLatin1String("QString");
+ expectedNext.append(QLatin1String("length"));
}
QQmlJSScope::ConstPtr scope = outerScope;