Improve object name translation.

This commit is contained in:
Roman Telezhynskyi 2020-11-04 14:33:40 +02:00
parent 0301c8289f
commit c77d4c9bd2
2 changed files with 10 additions and 7 deletions

View File

@ -520,14 +520,14 @@ void VToolOptionsPropertyBrowser::AddPropertyObjectName(Tool *i, const QString &
if (readOnly) if (readOnly)
{ {
auto *itemName = new VPE::VLabelProperty(propertyName); auto *itemName = new VPE::VLabelProperty(propertyName);
itemName->setValue(qApp->TrVars()->VarToUser(i->name())); itemName->setValue(i->name());
AddProperty(itemName, AttrName); AddProperty(itemName, AttrName);
} }
else else
{ {
auto *itemName = new VPE::VStringProperty(propertyName); auto *itemName = new VPE::VStringProperty(propertyName);
itemName->setClearButtonEnable(true); itemName->setClearButtonEnable(true);
itemName->setValue(qApp->TrVars()->VarToUser(i->name())); itemName->setValue(i->name());
itemName->setReadOnly(readOnly); itemName->setReadOnly(readOnly);
AddProperty(itemName, AttrName); AddProperty(itemName, AttrName);
} }
@ -3566,7 +3566,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
auto *i = qgraphicsitem_cast<VToolSpline *>(currentItem); auto *i = qgraphicsitem_cast<VToolSpline *>(currentItem);
const VSpline spl = i->getSpline(); const VSpline spl = i->getSpline();
idToProperty[AttrName]->setValue(qApp->TrVars()->VarToUser(i->name())); idToProperty[AttrName]->setValue(i->name());
VFormula angle1F(spl.GetStartAngleFormula(), i->getData()); VFormula angle1F(spl.GetStartAngleFormula(), i->getData());
angle1F.setCheckZero(false); angle1F.setCheckZero(false);
@ -3624,7 +3624,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCubicBezier()
{ {
auto *i = qgraphicsitem_cast<VToolCubicBezier *>(currentItem); auto *i = qgraphicsitem_cast<VToolCubicBezier *>(currentItem);
idToProperty[AttrName]->setValue(qApp->TrVars()->VarToUser(i->name())); idToProperty[AttrName]->setValue(i->name());
{ {
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle()); const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
@ -3662,7 +3662,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSplinePath()
{ {
auto *i = qgraphicsitem_cast<VToolSplinePath *>(currentItem); auto *i = qgraphicsitem_cast<VToolSplinePath *>(currentItem);
idToProperty[AttrName]->setValue(qApp->TrVars()->VarToUser(i->name())); idToProperty[AttrName]->setValue(i->name());
{ {
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle()); const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
@ -3684,7 +3684,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCubicBezierPath()
{ {
auto *i = qgraphicsitem_cast<VToolCubicBezierPath *>(currentItem); auto *i = qgraphicsitem_cast<VToolCubicBezierPath *>(currentItem);
idToProperty[AttrName]->setValue(qApp->TrVars()->VarToUser(i->name())); idToProperty[AttrName]->setValue(i->name());
{ {
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle()); const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());

View File

@ -41,6 +41,7 @@
#include "../vmisc/compatibility.h" #include "../vmisc/compatibility.h"
#include "../ifc/ifcdef.h" #include "../ifc/ifcdef.h"
#include "vgobject_p.h" #include "vgobject_p.h"
#include "../vmisc/vabstractapplication.h"
namespace namespace
{ {
@ -270,7 +271,9 @@ QString VGObject::GetAliasSuffix() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VGObject::ObjectName() 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;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------