diff options
-rw-r--r-- | src/libs/qmljs/qmljscheck.cpp | 23 | ||||
-rw-r--r-- | src/libs/qmljs/qmljsstaticanalysismessage.cpp | 4 | ||||
-rw-r--r-- | src/libs/qmljs/qmljsstaticanalysismessage.h | 2 |
3 files changed, 21 insertions, 8 deletions
diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp index 9102aa9216..9083952305 100644 --- a/src/libs/qmljs/qmljscheck.cpp +++ b/src/libs/qmljs/qmljscheck.cpp @@ -599,7 +599,7 @@ Check::Check(Document::Ptr doc, const ContextPtr &context) disableMessage(HintExtraParentheses); if (isQtQuick2Ui()) { - enableQmlDesignerChecks(); + disableQmlDesignerChecks(); } else { disableQmlDesignerChecks(); disableQmlDesignerUiFileChecks(); @@ -633,12 +633,11 @@ void Check::disableMessage(Type type) void Check::enableQmlDesignerChecks() { - enableMessage(StaticAnalysis::WarnImperativeCodeNotEditableInVisualDesigner); - enableMessage(StaticAnalysis::WarnUnsupportedTypeInVisualDesigner); - enableMessage(StaticAnalysis::WarnReferenceToParentItemNotSupportedByVisualDesigner); - enableMessage(StaticAnalysis::WarnReferenceToParentItemNotSupportedByVisualDesigner); - enableMessage(StaticAnalysis::WarnAboutQtQuick1InsteadQtQuick2); - enableMessage(StaticAnalysis::ErrUnsupportedRootTypeInVisualDesigner); + enableMessage(WarnImperativeCodeNotEditableInVisualDesigner); + enableMessage(WarnUnsupportedTypeInVisualDesigner); + enableMessage(WarnReferenceToParentItemNotSupportedByVisualDesigner); + enableMessage(WarnAboutQtQuick1InsteadQtQuick2); + enableMessage(ErrUnsupportedRootTypeInVisualDesigner); //## triggers too often ## check.enableMessage(StaticAnalysis::WarnUndefinedValueForVisualDesigner); } @@ -659,6 +658,8 @@ void Check::enableQmlDesignerUiFileChecks() enableMessage(ErrFunctionsNotSupportedInQmlUi); enableMessage(ErrBlocksNotSupportedInQmlUi); enableMessage(ErrBehavioursNotSupportedInQmlUi); + enableMessage(ErrStatesOnlyInRootItemInQmlUi); + enableMessage(ErrReferenceToParentItemNotSupportedInQmlUi); } void Check::disableQmlDesignerUiFileChecks() @@ -668,6 +669,8 @@ void Check::disableQmlDesignerUiFileChecks() disableMessage(ErrFunctionsNotSupportedInQmlUi); disableMessage(ErrBlocksNotSupportedInQmlUi); disableMessage(ErrBehavioursNotSupportedInQmlUi); + disableMessage(ErrStatesOnlyInRootItemInQmlUi); + disableMessage(ErrReferenceToParentItemNotSupportedInQmlUi); } bool Check::preVisit(Node *ast) @@ -823,8 +826,10 @@ void Check::visitQmlObject(Node *ast, UiQualifiedId *typeId, if (checkTypeForQmlUiSupport(typeId)) addMessage(ErrUnsupportedTypeInQmlUi, typeErrorLocation, typeName); - if (m_typeStack.count() > 1 && getRightMostIdentifier(typeId)->name.toString() == QLatin1String("State")) + if (m_typeStack.count() > 1 && getRightMostIdentifier(typeId)->name.toString() == QLatin1String("State")) { addMessage(WarnStatesOnlyInRootItemForVisualDesigner, typeErrorLocation); + addMessage(ErrStatesOnlyInRootItemInQmlUi, typeErrorLocation); + } if (m_typeStack.isEmpty() && unsupportedRootObjectTypesByVisualDesigner()->contains(typeName)) @@ -929,6 +934,8 @@ bool Check::visit(UiScriptBinding *ast) && checkTopLevelBindingForParentReference(cast<ExpressionStatement *>(ast->statement), _doc->source())) { addMessage(WarnReferenceToParentItemNotSupportedByVisualDesigner, locationFromRange(ast->firstSourceLocation(), ast->lastSourceLocation())); + addMessage(ErrReferenceToParentItemNotSupportedInQmlUi, + locationFromRange(ast->firstSourceLocation(), ast->lastSourceLocation())); } checkProperty(ast->qualifiedId); diff --git a/src/libs/qmljs/qmljsstaticanalysismessage.cpp b/src/libs/qmljs/qmljsstaticanalysismessage.cpp index dea0c12cc5..dd8c4098dd 100644 --- a/src/libs/qmljs/qmljsstaticanalysismessage.cpp +++ b/src/libs/qmljs/qmljsstaticanalysismessage.cpp @@ -234,6 +234,10 @@ StaticAnalysisMessages::StaticAnalysisMessages() tr("Java Script blocks are not supported in a Qt Quick ui file.")); newMsg(ErrBehavioursNotSupportedInQmlUi, Error, tr("Behaviours are not supported in a Qt Quick ui file.")); + newMsg(ErrStatesOnlyInRootItemInQmlUi, Error, + tr("States are only supported in the root item in a Qt Quick ui file.")); + newMsg(ErrReferenceToParentItemNotSupportedInQmlUi, Error, + tr("Referencing the parent of the root item is not supported in a Qt Quick ui file.")); } } // anonymous namespace diff --git a/src/libs/qmljs/qmljsstaticanalysismessage.h b/src/libs/qmljs/qmljsstaticanalysismessage.h index 9742fa5560..8980f2d9d9 100644 --- a/src/libs/qmljs/qmljsstaticanalysismessage.h +++ b/src/libs/qmljs/qmljsstaticanalysismessage.h @@ -104,6 +104,8 @@ enum Type ErrFunctionsNotSupportedInQmlUi = 222, ErrBlocksNotSupportedInQmlUi = 223, ErrBehavioursNotSupportedInQmlUi = 224, + ErrStatesOnlyInRootItemInQmlUi = 225, + ErrReferenceToParentItemNotSupportedInQmlUi = 226, ErrUnknownComponent = 300, ErrCouldNotResolvePrototypeOf = 301, ErrCouldNotResolvePrototype = 302, |