aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorEvgeniy A. Dushistov <dushistov@mail.ru>2020-08-18 22:22:10 +0300
committerEvgeniy A. Dushistov <dushistov@mail.ru>2020-08-19 10:09:30 +0300
commit69be96b97833cf45c72e8a29834b521e4523c507 (patch)
tree0152d96248ac3c304b4da2a2a57a1d3c8c0c05ef /tools
parent9bb8686f158fd5671dc6eb96aaefde7485d0f485 (diff)
qmllint: handle signals defined in qml file
FindWarningVisitor for signal add property "signal" + "Changed", so it was impossible find "singal" and "onSingal" names. Fixes: QTBUG-83793 Change-Id: I5a62211f413f543fdb6bf00e0ab921561d7a9643 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tools')
-rw-r--r--tools/qmllint/findwarnings.cpp31
1 files changed, 20 insertions, 11 deletions
diff --git a/tools/qmllint/findwarnings.cpp b/tools/qmllint/findwarnings.cpp
index b18cd82047..83e0c63653 100644
--- a/tools/qmllint/findwarnings.cpp
+++ b/tools/qmllint/findwarnings.cpp
@@ -496,19 +496,28 @@ bool FindWarningVisitor::visit(QQmlJS::AST::UiScriptBinding *uisb)
bool FindWarningVisitor::visit(QQmlJS::AST::UiPublicMember *uipm)
{
- // property bool inactive: !active
- // extract name inactive
- MetaProperty property(
+ if (uipm->type == QQmlJS::AST::UiPublicMember::Signal) {
+ MetaMethod method;
+ method.setMethodType(MetaMethod::Signal);
+ method.setMethodName(uipm->name.toString());
+ QQmlJS::AST::UiParameterList *param = uipm->parameters;
+ while (param) {
+ method.addParameter(param->name.toString(), param->type->name.toString());
+ param = param->next;
+ }
+ m_currentScope->addMethod(method);
+ } else {
+ // property bool inactive: !active
+ // extract name inactive
+ MetaProperty property(
uipm->name.toString(),
- // TODO: signals, complex types etc.
+ // TODO: complex types etc.
uipm->memberType ? uipm->memberType->name.toString() : QString(),
- uipm->typeModifier == QLatin1String("list"),
- !uipm->isReadonlyMember,
- false,
- uipm->memberType ? (uipm->memberType->name == QLatin1String("alias")) : false,
- 0);
- property.setType(m_exportedName2Scope.value(property.typeName()));
- m_currentScope->insertPropertyIdentifier(property);
+ uipm->typeModifier == QLatin1String("list"), !uipm->isReadonlyMember, false,
+ uipm->memberType ? (uipm->memberType->name == QLatin1String("alias")) : false, 0);
+ property.setType(m_exportedName2Scope.value(property.typeName()));
+ m_currentScope->insertPropertyIdentifier(property);
+ }
return true;
}