From 1a67aafe05131f3dfd4333d10138277d30ae1802 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 3 Jul 2015 20:06:30 +0300 Subject: [PATCH] Show translated names in combobox. --HG-- branch : develop --- src/libs/vtools/dialogs/tools/dialogtool.cpp | 42 ++++++++++++++++---- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/src/libs/vtools/dialogs/tools/dialogtool.cpp b/src/libs/vtools/dialogs/tools/dialogtool.cpp index 2bb101325..2d3169279 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtool.cpp @@ -155,7 +155,17 @@ void DialogTool::FillComboBoxCurves(QComboBox *box) const obj->getType() == GOType::SplinePath) && obj->getMode() == Draw::Calculation) { const QSharedPointer curve = data->GeometricObject(i.key()); - list[curve->name()] = i.key(); + + QString newName = curve->name(); + int bias = 0; + if (qApp->TrVars()->VariablesToUser(newName, 0, curve->name(), bias)) + { + list[newName] = i.key(); + } + else + { + list[curve->name()] = i.key(); + } } } } @@ -508,9 +518,7 @@ CrossCirclesPoint DialogTool::getCurrentCrossPoint(QComboBox *box) const bool DialogTool::SetObject(const quint32 &id, QComboBox *box, const QString &toolTip) { SCASSERT(box != nullptr); - const QSharedPointer obj = data->GetGObject(id); - SCASSERT(obj.isNull() == false); - const qint32 index = box->findText(obj->name()); + const qint32 index = box->findData(id); if ( index != -1 ) { // -1 for not found box->setCurrentIndex(index); @@ -519,7 +527,7 @@ bool DialogTool::SetObject(const quint32 &id, QComboBox *box, const QString &too } else { - qWarning()<<"Can't find object by name"<name(); + qWarning()<<"Can't find object by id"<getType() == gType && obj->getMode() == Draw::Calculation) { const QSharedPointer arc = data->GeometricObject(i.key()); - list[arc->name()] = i.key(); + + QString newName = arc->name(); + int bias = 0; + if (qApp->TrVars()->VariablesToUser(newName, 0, arc->name(), bias)) + { + list[newName] = i.key(); + } + else + { + list[arc->name()] = i.key(); + } } } } @@ -844,7 +862,17 @@ void DialogTool::FillCombo(QComboBox *box, GOType gType, FillComboBox rule, cons if (obj->getType() == gType && obj->getMode() == Draw::Calculation) { const QSharedPointer arc = data->GeometricObject(i.key()); - list[arc->name()] = i.key(); + + QString newName = arc->name(); + int bias = 0; + if (qApp->TrVars()->VariablesToUser(newName, 0, arc->name(), bias)) + { + list[newName] = i.key(); + } + else + { + list[arc->name()] = i.key(); + } } } }