PropertyEditorValue: improvement for isTranslated

isTranslated needs to take into account dynamic properties as well so the highlight of 'tr' button works properly for translated dynamic properties in the property editor.

Task-number: QDS-13513
Change-Id: I8694dc0b3b3d02351868fbe9a0777c6e4f1b6ee5
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Rafal Stawarski
2025-03-11 10:44:45 +01:00
committed by Tim Jenssen
parent 62f3df4f48
commit b9349b9c22

View File

@@ -222,9 +222,15 @@ void PropertyEditorValue::setIsValid(bool valid)
bool PropertyEditorValue::isTranslated() const
{
if (modelNode().isValid()) {
if (auto metaInfo = modelNode().metaInfo();
metaInfo.isValid() && metaInfo.hasProperty(name())
&& metaInfo.property(name()).propertyType().isString()) {
auto metaInfo = modelNode().metaInfo();
auto isString = metaInfo.isValid() && metaInfo.hasProperty(name())
&& metaInfo.property(name()).propertyType().isString();
auto property = modelNode().property(name());
auto isDynamicString = property.isValid() && property.isDynamic()
&& property.dynamicTypeName() == TypeNameView("string");
if (isString || isDynamicString) {
const QmlObjectNode objectNode(modelNode());
if (objectNode.hasBindingProperty(name())) {
const QRegularExpression rx(