QmlJS: Turn ErrDoNotMixTranslationFunctionsInQmlUi into a warning

Task-number: QDS-10548
Task-number: QDS-7597
Change-Id: I785fbf0f47f0753b257ef5fae1c3bf4afa9b416f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2023-08-30 09:46:59 +02:00
parent 61827510c0
commit 0af20575c1
3 changed files with 7 additions and 6 deletions

View File

@@ -675,7 +675,7 @@ QList<StaticAnalysis::Type> Check::defaultDisabledMessagesForNonQuickUi()
ErrBehavioursNotSupportedInQmlUi, ErrBehavioursNotSupportedInQmlUi,
ErrStatesOnlyInRootItemInQmlUi, ErrStatesOnlyInRootItemInQmlUi,
ErrReferenceToParentItemNotSupportedInQmlUi, ErrReferenceToParentItemNotSupportedInQmlUi,
ErrDoNotMixTranslationFunctionsInQmlUi, WarnDoNotMixTranslationFunctionsInQmlUi,
}); });
return disabled; return disabled;
} }
@@ -774,7 +774,7 @@ void Check::enableQmlDesignerUiFileChecks()
enableMessage(ErrBehavioursNotSupportedInQmlUi); enableMessage(ErrBehavioursNotSupportedInQmlUi);
enableMessage(ErrStatesOnlyInRootItemInQmlUi); enableMessage(ErrStatesOnlyInRootItemInQmlUi);
enableMessage(ErrReferenceToParentItemNotSupportedInQmlUi); enableMessage(ErrReferenceToParentItemNotSupportedInQmlUi);
enableMessage(ErrDoNotMixTranslationFunctionsInQmlUi); enableMessage(WarnDoNotMixTranslationFunctionsInQmlUi);
} }
void Check::disableQmlDesignerUiFileChecks() void Check::disableQmlDesignerUiFileChecks()
@@ -786,7 +786,7 @@ void Check::disableQmlDesignerUiFileChecks()
disableMessage(ErrBehavioursNotSupportedInQmlUi); disableMessage(ErrBehavioursNotSupportedInQmlUi);
disableMessage(ErrStatesOnlyInRootItemInQmlUi); disableMessage(ErrStatesOnlyInRootItemInQmlUi);
disableMessage(ErrReferenceToParentItemNotSupportedInQmlUi); disableMessage(ErrReferenceToParentItemNotSupportedInQmlUi);
disableMessage(ErrDoNotMixTranslationFunctionsInQmlUi); disableMessage(WarnDoNotMixTranslationFunctionsInQmlUi);
} }
bool Check::preVisit(Node *ast) bool Check::preVisit(Node *ast)
@@ -1937,7 +1937,7 @@ bool Check::visit(CallExpression *ast)
if (lastTransLationfunction != noTranslationfunction if (lastTransLationfunction != noTranslationfunction
&& lastTransLationfunction != translationFunction) && lastTransLationfunction != translationFunction)
addMessage(ErrDoNotMixTranslationFunctionsInQmlUi, location); addMessage(WarnDoNotMixTranslationFunctionsInQmlUi, location);
lastTransLationfunction = translationFunction; lastTransLationfunction = translationFunction;
} }

View File

@@ -218,7 +218,8 @@ StaticAnalysisMessages::StaticAnalysisMessages()
Tr::tr("States are only supported in the root item in a UI file (.ui.qml).")); Tr::tr("States are only supported in the root item in a UI file (.ui.qml)."));
newMsg(ErrReferenceToParentItemNotSupportedInQmlUi, Error, newMsg(ErrReferenceToParentItemNotSupportedInQmlUi, Error,
Tr::tr("Referencing the parent of the root item is not supported in a UI file (.ui.qml).")); Tr::tr("Referencing the parent of the root item is not supported in a UI file (.ui.qml)."));
newMsg(ErrDoNotMixTranslationFunctionsInQmlUi, Error, newMsg(WarnDoNotMixTranslationFunctionsInQmlUi,
Warning,
Tr::tr("Do not mix translation functions in a UI file (.ui.qml).")); Tr::tr("Do not mix translation functions in a UI file (.ui.qml)."));
newMsg(StateCannotHaveChildItem, Error, newMsg(StateCannotHaveChildItem, Error,
Tr::tr("A State cannot have a child item (%1)."), 1); Tr::tr("A State cannot have a child item (%1)."), 1);

View File

@@ -83,7 +83,7 @@ enum Type {
ErrBehavioursNotSupportedInQmlUi = 224, ErrBehavioursNotSupportedInQmlUi = 224,
ErrStatesOnlyInRootItemInQmlUi = 225, ErrStatesOnlyInRootItemInQmlUi = 225,
ErrReferenceToParentItemNotSupportedInQmlUi = 226, ErrReferenceToParentItemNotSupportedInQmlUi = 226,
ErrDoNotMixTranslationFunctionsInQmlUi = 227, WarnDoNotMixTranslationFunctionsInQmlUi = 227,
ErrUnknownComponent = 300, ErrUnknownComponent = 300,
ErrCouldNotResolvePrototypeOf = 301, ErrCouldNotResolvePrototypeOf = 301,
ErrCouldNotResolvePrototype = 302, ErrCouldNotResolvePrototype = 302,