From 2cab55ea1ae664e0677c6508efad4a52c181c1f5 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 28 Oct 2016 16:10:18 +0200 Subject: [PATCH] QmlDesigner: Allow JavaScrip blocks in Connections in .ui.qml Inside a Connections item JavaScript blocks should be allowed. Change-Id: Ia6a08fc575a72980bd53a32249bf302b7a426266 Reviewed-by: Marco Benelli --- src/libs/qmljs/qmljscheck.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp index c9c136d1781..936beec915f 100644 --- a/src/libs/qmljs/qmljscheck.cpp +++ b/src/libs/qmljs/qmljscheck.cpp @@ -1252,7 +1252,12 @@ bool Check::visit(BinaryExpression *ast) bool Check::visit(Block *ast) { - addMessage(ErrBlocksNotSupportedInQmlUi, locationFromRange(ast->firstSourceLocation(), ast->lastSourceLocation())); + + bool isDirectInConnectionsScope = + (!m_typeStack.isEmpty() && m_typeStack.last() == QLatin1String("Connections")); + + if (!isDirectInConnectionsScope) + addMessage(ErrBlocksNotSupportedInQmlUi, locationFromRange(ast->firstSourceLocation(), ast->lastSourceLocation())); if (Node *p = parent()) { if (!cast(p)