QmlJSEditor: Do not allow child items for states

Task-number: QTCREATORBUG-13003
Change-Id: I30bcee12803d2b3af804625ffdf417316e3d6c32
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
Thomas Hartmann
2016-06-21 18:33:15 +02:00
parent d04f103602
commit add3828389
3 changed files with 6 additions and 0 deletions

View File

@@ -820,6 +820,9 @@ void Check::visitQmlObject(Node *ast, UiQualifiedId *typeId,
const QString typeName = getRightMostIdentifier(typeId)->name.toString();
if (!m_typeStack.isEmpty() && m_typeStack.last() == QLatin1String("State"))
addMessage(StateCannotHaveChildItem, typeErrorLocation, typeName);
if (checkTypeForDesignerSupport(typeId))
addMessage(WarnUnsupportedTypeInVisualDesigner, typeErrorLocation, typeName);

View File

@@ -235,6 +235,8 @@ StaticAnalysisMessages::StaticAnalysisMessages()
tr("States are only supported in the root item in a Qt Quick UI form."));
newMsg(ErrReferenceToParentItemNotSupportedInQmlUi, Error,
tr("Referencing the parent of the root item is not supported in a Qt Quick UI form."));
newMsg(StateCannotHaveChildItem, Error,
tr("A State cannot have a child item (%1)."), 1);
}
} // anonymous namespace

View File

@@ -88,6 +88,7 @@ enum Type
HintExtraParentheses = 123,
MaybeWarnEqualityTypeCoercion = 126,
WarnConfusingExpressionStatement = 127,
StateCannotHaveChildItem = 128,
HintDeclarationsShouldBeAtStartOfFunction = 201,
HintOneStatementPerLine = 202,
WarnImperativeCodeNotEditableInVisualDesigner = 203,