QQmlProperty: fix signal handler warning
It should only be emitted if we find a signal of that name. Pick-to: 6.7 6.6 6.5 Fixes: QTBUG-118710 Change-Id: I15cf92c03dd7b46805e5a69078ca2beb6c862293 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
37ef144704
commit
9d10b79566
|
@ -411,13 +411,14 @@ void QQmlPropertyPrivate::initProperty(QObject *obj, const QString &name,
|
||||||
} else {
|
} else {
|
||||||
signalName = QQmlSignalNames::badHandlerNameToSignalName(terminal);
|
signalName = QQmlSignalNames::badHandlerNameToSignalName(terminal);
|
||||||
if (signalName) {
|
if (signalName) {
|
||||||
qWarning()
|
if (findSignal(*signalName)) {
|
||||||
<< terminal
|
qWarning()
|
||||||
<< "is not a properly capitalized signal handler name."
|
<< terminal
|
||||||
<< QQmlSignalNames::signalNameToHandlerName(*signalName)
|
<< "is not a properly capitalized signal handler name."
|
||||||
<< "would be correct.";
|
<< QQmlSignalNames::signalNameToHandlerName(*signalName)
|
||||||
if (findSignal(*signalName))
|
<< "would be correct.";
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 invalidateQPropertyChangeTriggers();
|
||||||
|
|
||||||
|
void propertyStartsWithOn();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QQmlEngine engine;
|
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<QObject> root(component.create());
|
||||||
|
QVERIFY(!root.isNull());
|
||||||
|
QCOMPARE(root->property("onlineStatus").toInt(), 12);
|
||||||
|
}
|
||||||
|
|
||||||
QTEST_MAIN(tst_qqmlproperty)
|
QTEST_MAIN(tst_qqmlproperty)
|
||||||
|
|
||||||
#include "tst_qqmlproperty.moc"
|
#include "tst_qqmlproperty.moc"
|
||||||
|
|
Loading…
Reference in New Issue