diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp index bdeb478a9b..a66704cb4a 100644 --- a/src/qml/qml/qqmlproperty.cpp +++ b/src/qml/qml/qqmlproperty.cpp @@ -411,13 +411,14 @@ void QQmlPropertyPrivate::initProperty(QObject *obj, const QString &name, } else { signalName = QQmlSignalNames::badHandlerNameToSignalName(terminal); if (signalName) { - qWarning() - << terminal - << "is not a properly capitalized signal handler name." - << QQmlSignalNames::signalNameToHandlerName(*signalName) - << "would be correct."; - if (findSignal(*signalName)) + if (findSignal(*signalName)) { + qWarning() + << terminal + << "is not a properly capitalized signal handler name." + << QQmlSignalNames::signalNameToHandlerName(*signalName) + << "would be correct."; return; + } } } 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 d833c16d77..05802a88d5 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; }; @@ -2590,6 +2592,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"