From c77d4c9bd2a617b36e0343b31063430dcdaa381e Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 4 Nov 2020 14:33:40 +0200 Subject: [PATCH] Improve object name translation. --- .../valentina/core/vtooloptionspropertybrowser.cpp | 12 ++++++------ src/libs/vgeometry/vgobject.cpp | 5 ++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.cpp b/src/app/valentina/core/vtooloptionspropertybrowser.cpp index 42643f8bf..57f520a23 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.cpp +++ b/src/app/valentina/core/vtooloptionspropertybrowser.cpp @@ -520,14 +520,14 @@ void VToolOptionsPropertyBrowser::AddPropertyObjectName(Tool *i, const QString & if (readOnly) { auto *itemName = new VPE::VLabelProperty(propertyName); - itemName->setValue(qApp->TrVars()->VarToUser(i->name())); + itemName->setValue(i->name()); AddProperty(itemName, AttrName); } else { auto *itemName = new VPE::VStringProperty(propertyName); itemName->setClearButtonEnable(true); - itemName->setValue(qApp->TrVars()->VarToUser(i->name())); + itemName->setValue(i->name()); itemName->setReadOnly(readOnly); AddProperty(itemName, AttrName); } @@ -3566,7 +3566,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline() auto *i = qgraphicsitem_cast(currentItem); const VSpline spl = i->getSpline(); - idToProperty[AttrName]->setValue(qApp->TrVars()->VarToUser(i->name())); + idToProperty[AttrName]->setValue(i->name()); VFormula angle1F(spl.GetStartAngleFormula(), i->getData()); angle1F.setCheckZero(false); @@ -3624,7 +3624,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCubicBezier() { auto *i = qgraphicsitem_cast(currentItem); - idToProperty[AttrName]->setValue(qApp->TrVars()->VarToUser(i->name())); + idToProperty[AttrName]->setValue(i->name()); { const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle()); @@ -3662,7 +3662,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSplinePath() { auto *i = qgraphicsitem_cast(currentItem); - idToProperty[AttrName]->setValue(qApp->TrVars()->VarToUser(i->name())); + idToProperty[AttrName]->setValue(i->name()); { const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle()); @@ -3684,7 +3684,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCubicBezierPath() { auto *i = qgraphicsitem_cast(currentItem); - idToProperty[AttrName]->setValue(qApp->TrVars()->VarToUser(i->name())); + idToProperty[AttrName]->setValue(i->name()); { const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle()); diff --git a/src/libs/vgeometry/vgobject.cpp b/src/libs/vgeometry/vgobject.cpp index 5f30ba6b6..fd8c3d196 100644 --- a/src/libs/vgeometry/vgobject.cpp +++ b/src/libs/vgeometry/vgobject.cpp @@ -41,6 +41,7 @@ #include "../vmisc/compatibility.h" #include "../ifc/ifcdef.h" #include "vgobject_p.h" +#include "../vmisc/vabstractapplication.h" namespace { @@ -270,7 +271,9 @@ QString VGObject::GetAliasSuffix() const //--------------------------------------------------------------------------------------------------------------------- QString VGObject::ObjectName() const { - return not d->m_alias.isEmpty() ? QString("%1 (%2)").arg(d->m_alias, d->_name) : d->_name; + const QString alias = qApp->TrVars()->VarToUser(d->m_alias); + const QString name = qApp->TrVars()->VarToUser(d->_name); + return not d->m_alias.isEmpty() ? QString("%1 (%2)").arg(alias, name) : name; } //---------------------------------------------------------------------------------------------------------------------