aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/qml/qqmlproperty.cpp4
-rw-r--r--tests/auto/qml/qqmlproperty/data/aliasToIdWithMatchingQmlFileName.qml9
-rw-r--r--tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp12
3 files changed, 24 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp
index 8ecd597a39..ebf296b29d 100644
--- a/src/qml/qml/qqmlproperty.cpp
+++ b/src/qml/qml/qqmlproperty.cpp
@@ -269,7 +269,9 @@ void QQmlPropertyPrivate::initProperty(QObject *obj, const QString &name)
for (int ii = 0; ii < path.count() - 1; ++ii) {
const QStringRef &pathName = path.at(ii);
- if (typeNameCache) {
+ // Types must begin with an uppercase letter (see checkRegistration()
+ // in qqmlmetatype.cpp for the enforcement of this).
+ if (typeNameCache && !pathName.isEmpty() && pathName.at(0).isUpper()) {
QQmlTypeNameCache::Result r = typeNameCache->query(pathName);
if (r.isValid()) {
if (r.type.isValid()) {
diff --git a/tests/auto/qml/qqmlproperty/data/aliasToIdWithMatchingQmlFileName.qml b/tests/auto/qml/qqmlproperty/data/aliasToIdWithMatchingQmlFileName.qml
new file mode 100644
index 0000000000..8cbd928f36
--- /dev/null
+++ b/tests/auto/qml/qqmlproperty/data/aliasToIdWithMatchingQmlFileName.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+Item {
+ property alias testType: testType
+
+ Rectangle {
+ id: testType
+ }
+}
diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
index 128dc21b9a..1e9ba80264 100644
--- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
+++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
@@ -143,6 +143,7 @@ private slots:
void registeredCompositeTypeProperty();
void deeplyNestedObject();
void readOnlyDynamicProperties();
+ void aliasToIdWithMatchingQmlFileNameOnCaseInsensitiveFileSystem();
void floatToStringPrecision_data();
void floatToStringPrecision();
@@ -2047,6 +2048,17 @@ void tst_qqmlproperty::readOnlyDynamicProperties()
delete obj;
}
+void tst_qqmlproperty::aliasToIdWithMatchingQmlFileNameOnCaseInsensitiveFileSystem()
+{
+ const QUrl url = testFileUrl("aliasToIdWithMatchingQmlFileName.qml");
+ QQmlEngine engine;
+ QQmlComponent component(&engine, url);
+ QScopedPointer<QObject> root(component.create());
+
+ QQmlProperty property(root.data(), "testType.objectName", QQmlEngine::contextForObject(root.data()));
+ QVERIFY(property.isValid());
+}
+
void tst_qqmlproperty::floatToStringPrecision_data()
{
QTest::addColumn<QString>("propertyName");