diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp index ba6a0971f2..53d810d7a6 100644 --- a/src/qml/qml/qqmlproperty.cpp +++ b/src/qml/qml/qqmlproperty.cpp @@ -428,13 +428,14 @@ void QQmlPropertyPrivate::initProperty(QObject *obj, const QString &name, if (result != end) *result = result->toUpper(); - qWarning() - << terminalString - << "is not a properly capitalized signal handler name." - << handlerName - << "would be correct."; - if (findSignalInMetaObject(signalName.toUtf8())) + if (findSignalInMetaObject(signalName.toUtf8())) { + qWarning() + << terminalString + << "is not a properly capitalized signal handler name." + << handlerName + << "would be correct."; return; + } } if (ddata && ddata->propertyCache) { diff --git a/tests/auto/qml/qqmlproperty/data/propertyStartsWithOn.qml b/tests/auto/qml/qqmlproperty/data/propertyStartsWithOn.qml new file mode 100644 index 0000000000..0ced54a9ca --- /dev/null +++ b/tests/auto/qml/qqmlproperty/data/propertyStartsWithOn.qml @@ -0,0 +1,9 @@ +import QtQml + +QtObject { + id: root + property int onlineStatus + property Binding b: Binding { + root.onlineStatus: 12 + } +} diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp index bb335e5ad3..1d542ae3d2 100644 --- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp +++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp @@ -222,6 +222,8 @@ private slots: void invalidateQPropertyChangeTriggers(); + void propertyStartsWithOn(); + private: QQmlEngine engine; }; @@ -2589,6 +2591,18 @@ void tst_qqmlproperty::invalidateQPropertyChangeTriggers() })); } +void tst_qqmlproperty::propertyStartsWithOn() +{ + QTest::failOnWarning("\"onlineStatus\" is not a properly capitalized signal handler name. " + "\"onLineStatus\" would be correct."); + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("propertyStartsWithOn.qml")); + QVERIFY2(component.isReady(), qPrintable(component.errorString())); + QScopedPointer root(component.create()); + QVERIFY(!root.isNull()); + QCOMPARE(root->property("onlineStatus").toInt(), 12); +} + QTEST_MAIN(tst_qqmlproperty) #include "tst_qqmlproperty.moc"