QQmlProperty: fix signal handler warning
It should only be emitted if we find a signal of that name. Pick-to: 6.5 Fixes: QTBUG-118710 Change-Id: I15cf92c03dd7b46805e5a69078ca2beb6c862293 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit9d10b79566
) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit6c0489e65f
)
This commit is contained in:
parent
c753d52d8e
commit
e5d8daf821
|
@ -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) {
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
import QtQml
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
property int onlineStatus
|
||||
property Binding b: Binding {
|
||||
root.onlineStatus: 12
|
||||
}
|
||||
}
|
|
@ -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<QObject> root(component.create());
|
||||
QVERIFY(!root.isNull());
|
||||
QCOMPARE(root->property("onlineStatus").toInt(), 12);
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_qqmlproperty)
|
||||
|
||||
#include "tst_qqmlproperty.moc"
|
||||
|
|
Loading…
Reference in New Issue