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 <marco.benelli@qt.io>
This commit is contained in:
Thomas Hartmann
2016-10-28 16:10:18 +02:00
committed by Thomas Hartmann
parent 1562ec7bce
commit 2cab55ea1a

View File

@@ -1252,7 +1252,12 @@ bool Check::visit(BinaryExpression *ast)
bool Check::visit(Block *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 (Node *p = parent()) {
if (!cast<UiScriptBinding *>(p) if (!cast<UiScriptBinding *>(p)