forked from qt-creator/qt-creator
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:
@@ -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);
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -88,6 +88,7 @@ enum Type
|
||||
HintExtraParentheses = 123,
|
||||
MaybeWarnEqualityTypeCoercion = 126,
|
||||
WarnConfusingExpressionStatement = 127,
|
||||
StateCannotHaveChildItem = 128,
|
||||
HintDeclarationsShouldBeAtStartOfFunction = 201,
|
||||
HintOneStatementPerLine = 202,
|
||||
WarnImperativeCodeNotEditableInVisualDesigner = 203,
|
||||
|
Reference in New Issue
Block a user