diff options
-rw-r--r-- | src/qml/qml/qqmlcompiler.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlproperty.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/data/missingSignal.2.errors.txt | 1 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/data/missingSignal.2.qml | 11 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 1 |
5 files changed, 15 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp index 71c5bdcfbe..5df02d0bc1 100644 --- a/src/qml/qml/qqmlcompiler.cpp +++ b/src/qml/qml/qqmlcompiler.cpp @@ -3812,7 +3812,7 @@ QQmlCompiler::signal(QQmlScript::Object *object, const QHashedStringRef &name, b if (d && !cache->isAllowedInRevision(d)) { if (notInRevision) *notInRevision = true; return 0; - } else if (d) { + } else if (d && d->isSignal()) { return d; } diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp index 945f6de5c0..33f860fb17 100644 --- a/src/qml/qml/qqmlproperty.cpp +++ b/src/qml/qml/qqmlproperty.cpp @@ -1870,7 +1870,7 @@ QMetaMethod QQmlPropertyPrivate::findSignalByName(const QMetaObject *mo, const Q for (int ii = methods - 1; ii >= 2; --ii) { // >= 2 to block the destroyed signal QMetaMethod method = mo->method(ii); - if (method.name() == name) + if (method.name() == name && (method.methodType() & QMetaMethod::Signal)) return method; } diff --git a/tests/auto/qml/qqmllanguage/data/missingSignal.2.errors.txt b/tests/auto/qml/qqmllanguage/data/missingSignal.2.errors.txt new file mode 100644 index 0000000000..33bf3070d7 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/missingSignal.2.errors.txt @@ -0,0 +1 @@ +8:5:Cannot assign to non-existent property "onDynamicMethod" diff --git a/tests/auto/qml/qqmllanguage/data/missingSignal.2.qml b/tests/auto/qml/qqmllanguage/data/missingSignal.2.qml new file mode 100644 index 0000000000..b4297ce67d --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/missingSignal.2.qml @@ -0,0 +1,11 @@ +import Test 1.0 +MyQmlObject { + function dynamicMethod() { + basicSlot(); + } + + // invalid: signal handler definition given for non-signal method. + onDynamicMethod: { + basicSlot(); + } +} diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index e32489635b..9205f2d730 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -337,6 +337,7 @@ void tst_qqmllanguage::errors_data() QTest::newRow("missingObject") << "missingObject.qml" << "missingObject.errors.txt" << false; QTest::newRow("failingComponent") << "failingComponentTest.qml" << "failingComponent.errors.txt" << false; QTest::newRow("missingSignal") << "missingSignal.qml" << "missingSignal.errors.txt" << false; + QTest::newRow("missingSignal2") << "missingSignal.2.qml" << "missingSignal.2.errors.txt" << false; QTest::newRow("finalOverride") << "finalOverride.qml" << "finalOverride.errors.txt" << false; QTest::newRow("customParserIdNotAllowed") << "customParserIdNotAllowed.qml" << "customParserIdNotAllowed.errors.txt" << false; |