[TD]apply translateLabel after all addObject calls

This commit is contained in:
wandererfan
2023-08-16 21:12:59 -04:00
committed by WandererFan
parent 6c0f8728bb
commit a8cc561396
17 changed files with 118 additions and 59 deletions

View File

@@ -135,7 +135,8 @@ TechDraw::DrawViewImage* TaskActiveView::createActiveView()
}
//we are sure we have a 3D window!
const std::string objectName{QT_TR_NOOP("ActiveView")};
const std::string objectName{"ActiveView"};
std::string imageName = m_pageFeat->getDocument()->getUniqueObjectName(objectName.c_str());
std::string generatedSuffix {imageName.substr(objectName.length())};
std::string imageType = "TechDraw::DrawViewImage";
@@ -146,6 +147,10 @@ TechDraw::DrawViewImage* TaskActiveView::createActiveView()
//document by name instead of using ActiveDocument
Command::doCommand(Command::Doc, "App.getDocument('%s').addObject('%s','%s')",
documentName.c_str(), imageType.c_str(), imageName.c_str());
Command::doCommand(Command::Doc, "App.activeDocument().%s.translateLabel('DrawActiveView', 'ActiveView', '%s')",
imageName.c_str(), imageName.c_str());
Command::doCommand(Command::Doc, "App.getDocument('%s').%s.addView(App.getDocument('%s').%s)",
documentName.c_str(), pageName.c_str(), documentName.c_str(),
imageName.c_str());
@@ -212,9 +217,6 @@ TechDraw::DrawViewImage* TaskActiveView::createActiveView()
}
}
std::string translatedObjectName{tr("ActiveView").toStdString()};
newObj->Label.setValue(translatedObjectName + generatedSuffix);
return newImg;
}