Part: Use QStringLiteral
This commit is contained in:
@@ -135,10 +135,10 @@ PyMOD_INIT_FUNC(PartGui)
|
||||
|
||||
Base::Console().Log("Loading GUI of Part module... done\n");
|
||||
|
||||
Gui::BitmapFactory().addPath(QString::fromLatin1(":/icons/booleans"));
|
||||
Gui::BitmapFactory().addPath(QString::fromLatin1(":/icons/create"));
|
||||
Gui::BitmapFactory().addPath(QString::fromLatin1(":/icons/parametric"));
|
||||
Gui::BitmapFactory().addPath(QString::fromLatin1(":/icons/tools"));
|
||||
Gui::BitmapFactory().addPath(QStringLiteral(":/icons/booleans"));
|
||||
Gui::BitmapFactory().addPath(QStringLiteral(":/icons/create"));
|
||||
Gui::BitmapFactory().addPath(QStringLiteral(":/icons/parametric"));
|
||||
Gui::BitmapFactory().addPath(QStringLiteral(":/icons/tools"));
|
||||
|
||||
// clang-format off
|
||||
static struct PyModuleDef pAttachEngineTextsModuleDef = {
|
||||
|
||||
@@ -369,7 +369,7 @@ QStringList getRefListForMode(AttachEngine &attacher, eMapMode mmode)
|
||||
for(eRefType rt : rts){
|
||||
buf.append(getShapeTypeText(rt));
|
||||
}
|
||||
strlist.append(buf.join(QString::fromLatin1(", ")));
|
||||
strlist.append(buf.join(QStringLiteral(", ")));
|
||||
}
|
||||
return strlist;
|
||||
}
|
||||
|
||||
@@ -940,11 +940,11 @@ void CmdPartImport::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
QStringList filter;
|
||||
filter << QString::fromLatin1("STEP (*.stp *.step)");
|
||||
filter << QString::fromLatin1("STEP with colors (*.stp *.step)");
|
||||
filter << QString::fromLatin1("IGES (*.igs *.iges)");
|
||||
filter << QString::fromLatin1("IGES with colors (*.igs *.iges)");
|
||||
filter << QString::fromLatin1("BREP (*.brp *.brep)");
|
||||
filter << QStringLiteral("STEP (*.stp *.step)");
|
||||
filter << QStringLiteral("STEP with colors (*.stp *.step)");
|
||||
filter << QStringLiteral("IGES (*.igs *.iges)");
|
||||
filter << QStringLiteral("IGES with colors (*.igs *.iges)");
|
||||
filter << QStringLiteral("BREP (*.brp *.brep)");
|
||||
|
||||
QString select;
|
||||
QString fn = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), QString(), QString(), filter.join(QLatin1String(";;")), &select);
|
||||
@@ -1003,11 +1003,11 @@ void CmdPartExport::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
QStringList filter;
|
||||
filter << QString::fromLatin1("STEP (*.stp *.step)");
|
||||
filter << QString::fromLatin1("STEP with colors (*.stp *.step)");
|
||||
filter << QString::fromLatin1("IGES (*.igs *.iges)");
|
||||
filter << QString::fromLatin1("IGES with colors (*.igs *.iges)");
|
||||
filter << QString::fromLatin1("BREP (*.brp *.brep)");
|
||||
filter << QStringLiteral("STEP (*.stp *.step)");
|
||||
filter << QStringLiteral("STEP with colors (*.stp *.step)");
|
||||
filter << QStringLiteral("IGES (*.igs *.iges)");
|
||||
filter << QStringLiteral("IGES with colors (*.igs *.iges)");
|
||||
filter << QStringLiteral("BREP (*.brp *.brep)");
|
||||
|
||||
QString select;
|
||||
QString fn = Gui::FileDialog::getSaveFileName(Gui::getMainWindow(), QString(), QString(), filter.join(QLatin1String(";;")), &select);
|
||||
@@ -1051,12 +1051,12 @@ void CmdPartImportCurveNet::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
QStringList filter;
|
||||
filter << QString::fromLatin1("%1 (*.stp *.step *.igs *.iges *.brp *.brep)")
|
||||
filter << QStringLiteral("%1 (*.stp *.step *.igs *.iges *.brp *.brep)")
|
||||
.arg(QObject::tr("All CAD Files"));
|
||||
filter << QString::fromLatin1("STEP (*.stp *.step)");
|
||||
filter << QString::fromLatin1("IGES (*.igs *.iges)");
|
||||
filter << QString::fromLatin1("BREP (*.brp *.brep)");
|
||||
filter << QString::fromLatin1("%1 (*.*)")
|
||||
filter << QStringLiteral("STEP (*.stp *.step)");
|
||||
filter << QStringLiteral("IGES (*.igs *.iges)");
|
||||
filter << QStringLiteral("BREP (*.brp *.brep)");
|
||||
filter << QStringLiteral("%1 (*.*)")
|
||||
.arg(QObject::tr("All Files"));
|
||||
|
||||
QString fn = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), QString(), QString(), filter.join(QLatin1String(";;")));
|
||||
@@ -1111,7 +1111,7 @@ void CmdPartMakeSolid::activated(int iMsg)
|
||||
it->Label.getValue());
|
||||
}
|
||||
else if (type == TopAbs_COMPOUND || type == TopAbs_COMPSOLID) {
|
||||
str = QString::fromLatin1(
|
||||
str = QStringLiteral(
|
||||
"__s__=App.ActiveDocument.%1.Shape.Faces\n"
|
||||
"__s__=Part.Solid(Part.Shell(__s__))\n"
|
||||
"__o__=App.ActiveDocument.addObject(\"Part::Feature\",\"%1_solid\")\n"
|
||||
@@ -1123,7 +1123,7 @@ void CmdPartMakeSolid::activated(int iMsg)
|
||||
QLatin1String(it->Label.getValue()));
|
||||
}
|
||||
else if (type == TopAbs_SHELL) {
|
||||
str = QString::fromLatin1(
|
||||
str = QStringLiteral(
|
||||
"__s__=App.ActiveDocument.%1.Shape\n"
|
||||
"__s__=Part.Solid(__s__)\n"
|
||||
"__o__=App.ActiveDocument.addObject(\"Part::Feature\",\"%1_solid\")\n"
|
||||
@@ -1186,7 +1186,7 @@ void CmdPartReverseShape::activated(int iMsg)
|
||||
name += "_rev";
|
||||
name = getUniqueObjectName(name.c_str());
|
||||
|
||||
QString str = QString::fromLatin1(
|
||||
QString str = QStringLiteral(
|
||||
"__o__=App.ActiveDocument.addObject(\"Part::Reverse\",\"%1\")\n"
|
||||
"__o__.Source=App.ActiveDocument.%2\n"
|
||||
"__o__.Label=\"%3 (Rev)\"\n"
|
||||
@@ -2222,10 +2222,10 @@ namespace {
|
||||
|
||||
if (activeObj) {
|
||||
QString activeName = QString::fromLatin1(activeObj->getNameInDocument());
|
||||
return QString::fromLatin1("App.ActiveDocument.getObject('%1\').addObject(obj)\n").arg(activeName);
|
||||
return QStringLiteral("App.ActiveDocument.getObject('%1\').addObject(obj)\n").arg(activeName);
|
||||
}
|
||||
|
||||
return QString::fromLatin1("# Object created at document root.");
|
||||
return QStringLiteral("# Object created at document root.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -87,16 +87,16 @@ Gui::Action * PartCmdSelectFilter::createAction()
|
||||
|
||||
QAction* cmd0 = pcAction->addAction(QString());
|
||||
cmd0->setIcon(Gui::BitmapFactory().iconFromTheme("vertex-selection"));
|
||||
cmd0->setShortcut(QKeySequence(QString::fromUtf8("X,S")));
|
||||
cmd0->setShortcut(QKeySequence(QStringLiteral("X,S")));
|
||||
QAction* cmd1 = pcAction->addAction(QString());
|
||||
cmd1->setIcon(Gui::BitmapFactory().iconFromTheme("edge-selection"));
|
||||
cmd1->setShortcut(QKeySequence(QString::fromUtf8("E,S")));
|
||||
cmd1->setShortcut(QKeySequence(QStringLiteral("E,S")));
|
||||
QAction* cmd2 = pcAction->addAction(QString());
|
||||
cmd2->setIcon(Gui::BitmapFactory().iconFromTheme("face-selection"));
|
||||
cmd2->setShortcut(QKeySequence(QString::fromUtf8("F,S")));
|
||||
cmd2->setShortcut(QKeySequence(QStringLiteral("F,S")));
|
||||
QAction* cmd3 = pcAction->addAction(QString());
|
||||
cmd3->setIcon(Gui::BitmapFactory().iconFromTheme("clear-selection"));
|
||||
cmd3->setShortcut(QKeySequence(QString::fromUtf8("C,S")));
|
||||
cmd3->setShortcut(QKeySequence(QStringLiteral("C,S")));
|
||||
|
||||
_pcAction = pcAction;
|
||||
languageChange();
|
||||
|
||||
@@ -44,11 +44,11 @@ QString getAutoGroupCommandStr()
|
||||
App::Part* activePart = Gui::Application::Instance->activeView()->getActiveObject<App::Part*>("part");
|
||||
if (activePart) {
|
||||
QString activePartName = QString::fromLatin1(activePart->getNameInDocument());
|
||||
return QString::fromLatin1("App.ActiveDocument.getObject('%1\')."
|
||||
return QStringLiteral("App.ActiveDocument.getObject('%1\')."
|
||||
"addObject(App.ActiveDocument.ActiveObject)\n")
|
||||
.arg(activePartName);
|
||||
}
|
||||
return QString::fromLatin1("# Object created at document root.");
|
||||
return QStringLiteral("# Object created at document root.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ void CmdPartCylinder::activated(int iMsg)
|
||||
openCommand((const char*)cmd.toUtf8());
|
||||
|
||||
runCommand(Doc,"App.ActiveDocument.addObject(\"Part::Cylinder\",\"Cylinder\")");
|
||||
cmd = QString::fromLatin1("App.ActiveDocument.ActiveObject.Label = \"%1\"")
|
||||
cmd = QStringLiteral("App.ActiveDocument.ActiveObject.Label = \"%1\"")
|
||||
.arg(qApp->translate("CmdPartCylinder","Cylinder"));
|
||||
runCommand(Doc,cmd.toUtf8());
|
||||
runCommand(Doc, getAutoGroupCommandStr().toUtf8());
|
||||
@@ -119,7 +119,7 @@ void CmdPartBox::activated(int iMsg)
|
||||
openCommand((const char*)cmd.toUtf8());
|
||||
|
||||
runCommand(Doc,"App.ActiveDocument.addObject(\"Part::Box\",\"Box\")");
|
||||
cmd = QString::fromLatin1("App.ActiveDocument.ActiveObject.Label = \"%1\"")
|
||||
cmd = QStringLiteral("App.ActiveDocument.ActiveObject.Label = \"%1\"")
|
||||
.arg(qApp->translate("CmdPartBox","Cube"));
|
||||
runCommand(Doc,cmd.toUtf8());
|
||||
runCommand(Doc, getAutoGroupCommandStr().toUtf8());
|
||||
@@ -161,7 +161,7 @@ void CmdPartSphere::activated(int iMsg)
|
||||
openCommand((const char*)cmd.toUtf8());
|
||||
|
||||
runCommand(Doc,"App.ActiveDocument.addObject(\"Part::Sphere\",\"Sphere\")");
|
||||
cmd = QString::fromLatin1("App.ActiveDocument.ActiveObject.Label = \"%1\"")
|
||||
cmd = QStringLiteral("App.ActiveDocument.ActiveObject.Label = \"%1\"")
|
||||
.arg(qApp->translate("CmdPartSphere","Sphere"));
|
||||
runCommand(Doc,cmd.toUtf8());
|
||||
runCommand(Doc, getAutoGroupCommandStr().toUtf8());
|
||||
@@ -203,7 +203,7 @@ void CmdPartCone::activated(int iMsg)
|
||||
openCommand((const char*)cmd.toUtf8());
|
||||
|
||||
runCommand(Doc,"App.ActiveDocument.addObject(\"Part::Cone\",\"Cone\")");
|
||||
cmd = QString::fromLatin1("App.ActiveDocument.ActiveObject.Label = \"%1\"")
|
||||
cmd = QStringLiteral("App.ActiveDocument.ActiveObject.Label = \"%1\"")
|
||||
.arg(qApp->translate("CmdPartCone","Cone"));
|
||||
runCommand(Doc,cmd.toUtf8());
|
||||
runCommand(Doc, getAutoGroupCommandStr().toUtf8());
|
||||
@@ -245,7 +245,7 @@ void CmdPartTorus::activated(int iMsg)
|
||||
openCommand((const char*)cmd.toUtf8());
|
||||
|
||||
runCommand(Doc,"App.ActiveDocument.addObject(\"Part::Torus\",\"Torus\")");
|
||||
cmd = QString::fromLatin1("App.ActiveDocument.ActiveObject.Label = \"%1\"")
|
||||
cmd = QStringLiteral("App.ActiveDocument.ActiveObject.Label = \"%1\"")
|
||||
.arg(qApp->translate("CmdPartTorus","Torus"));
|
||||
runCommand(Doc,cmd.toUtf8());
|
||||
runCommand(Doc, getAutoGroupCommandStr().toUtf8());
|
||||
|
||||
@@ -273,21 +273,21 @@ void CrossSections::apply()
|
||||
App::Document* doc = it->getDocument();
|
||||
std::string s = it->getNameInDocument();
|
||||
s += "_cs";
|
||||
Gui::Command::runCommand(Gui::Command::App, QString::fromLatin1(
|
||||
Gui::Command::runCommand(Gui::Command::App, QStringLiteral(
|
||||
"wires=list()\n"
|
||||
"shape=FreeCAD.getDocument(\"%1\").%2.Shape\n")
|
||||
.arg(QLatin1String(doc->getName()),
|
||||
QLatin1String(it->getNameInDocument())).toLatin1());
|
||||
|
||||
for (double jt : d) {
|
||||
Gui::Command::runCommand(Gui::Command::App, QString::fromLatin1(
|
||||
Gui::Command::runCommand(Gui::Command::App, QStringLiteral(
|
||||
"for i in shape.slice(Base.Vector(%1,%2,%3),%4):\n"
|
||||
" wires.append(i)\n"
|
||||
).arg(a).arg(b).arg(c).arg(jt).toLatin1());
|
||||
seq.next();
|
||||
}
|
||||
|
||||
Gui::Command::runCommand(Gui::Command::App, QString::fromLatin1(
|
||||
Gui::Command::runCommand(Gui::Command::App, QStringLiteral(
|
||||
"comp=Part.Compound(wires)\n"
|
||||
"slice=FreeCAD.getDocument(\"%1\").addObject(\"Part::Feature\",\"%2\")\n"
|
||||
"slice.Shape=comp\n"
|
||||
|
||||
@@ -146,7 +146,7 @@ DlgExportHeaderStep::DlgExportHeaderStep(QWidget* parent)
|
||||
ui->lineEditProduct->setReadOnly(true);
|
||||
|
||||
QRegularExpression rx;
|
||||
rx.setPattern(QString::fromLatin1("[\\x00-\\x7F]+"));
|
||||
rx.setPattern(QStringLiteral("[\\x00-\\x7F]+"));
|
||||
QRegularExpressionValidator* companyValidator = new QRegularExpressionValidator(ui->lineEditCompany);
|
||||
companyValidator->setRegularExpression(rx);
|
||||
ui->lineEditCompany->setValidator(companyValidator);
|
||||
|
||||
@@ -207,7 +207,7 @@ void DlgExtrusion::onSelectEdgeClicked()
|
||||
|
||||
//visibility automation
|
||||
try{
|
||||
QString code = QString::fromLatin1(
|
||||
QString code = QStringLiteral(
|
||||
"import Show\n"
|
||||
"tv = Show.TempoVis(App.ActiveDocument, tag= 'PartGui::DlgExtrusion')\n"
|
||||
"tv.hide([%1])"
|
||||
@@ -217,9 +217,9 @@ void DlgExtrusion::onSelectEdgeClicked()
|
||||
for (App::DocumentObject* obj: sources){
|
||||
if (!obj)
|
||||
continue;
|
||||
features_to_hide.append(QString::fromLatin1("App.ActiveDocument."));
|
||||
features_to_hide.append(QStringLiteral("App.ActiveDocument."));
|
||||
features_to_hide.append(QString::fromLatin1(obj->getNameInDocument()));
|
||||
features_to_hide.append(QString::fromLatin1(", \n"));
|
||||
features_to_hide.append(QStringLiteral(", \n"));
|
||||
}
|
||||
QByteArray code_2 = code.arg(features_to_hide).toLatin1();
|
||||
Base::Interpreter().runString(code_2.constData());
|
||||
@@ -474,8 +474,8 @@ void DlgExtrusion::apply()
|
||||
name = sourceObj->getDocument()->getUniqueObjectName("Extrude").c_str();
|
||||
if (addBaseName) {
|
||||
//FIXME: implement
|
||||
//QString baseName = QString::fromLatin1("Extrude_%1").arg(sourceObjectName);
|
||||
//label = QString::fromLatin1("%1_Extrude").arg((*it)->text(0));
|
||||
//QString baseName = QStringLiteral("Extrude_%1").arg(sourceObjectName);
|
||||
//label = QStringLiteral("%1_Extrude").arg((*it)->text(0));
|
||||
}
|
||||
|
||||
FCMD_OBJ_DOC_CMD(sourceObj,"addObject('Part::Extrusion','" << name << "')");
|
||||
@@ -505,7 +505,7 @@ void DlgExtrusion::apply()
|
||||
}
|
||||
catch(...) {
|
||||
QMessageBox::critical(this, windowTitle(),
|
||||
tr("Creating Extrusion failed.\n%1").arg(QString::fromUtf8("Unknown error")));
|
||||
tr("Creating Extrusion failed.\n%1").arg(QStringLiteral("Unknown error")));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -604,7 +604,7 @@ void DlgExtrusion::setAxisLink(const char* objname, const char* subname)
|
||||
if(objname && strlen(objname) > 0){
|
||||
QString txt = QString::fromLatin1(objname);
|
||||
if (subname && strlen(subname) > 0){
|
||||
txt = txt + QString::fromLatin1(":") + QString::fromLatin1(subname);
|
||||
txt = txt + QStringLiteral(":") + QString::fromLatin1(subname);
|
||||
}
|
||||
ui->txtLink->setText(txt);
|
||||
} else {
|
||||
@@ -677,7 +677,7 @@ bool DlgExtrusion::validate()
|
||||
} catch(Standard_Failure &err) {
|
||||
errmsg = QString::fromLocal8Bit(err.GetMessageString());
|
||||
} catch(...) {
|
||||
errmsg = QString::fromUtf8("Unknown error");
|
||||
errmsg = QStringLiteral("Unknown error");
|
||||
}
|
||||
if (errmsg.length() > 0){
|
||||
QMessageBox::critical(this, windowTitle(), tr("Can't determine normal vector of shape to be extruded. Please use other mode. \n\n(%1)").arg(errmsg));
|
||||
|
||||
@@ -108,7 +108,7 @@ void FilletRadiusDelegate::setModelData(QWidget *editor, QAbstractItemModel *mod
|
||||
Gui::QuantitySpinBox *spinBox = static_cast<Gui::QuantitySpinBox*>(editor);
|
||||
spinBox->interpretText();
|
||||
//double value = spinBox->value();
|
||||
//QString value = QString::fromLatin1("%1").arg(spinBox->value(),0,'f',2);
|
||||
//QString value = QStringLiteral("%1").arg(spinBox->value(),0,'f',2);
|
||||
//QString value = QLocale().toString(spinBox->value().getValue(),'f',Base::UnitsApi::getDecimals());
|
||||
Base::Quantity value = spinBox->value();
|
||||
|
||||
@@ -437,7 +437,7 @@ void DlgFilletEdges::onSelectEdge(const QString& subelement, int type)
|
||||
QAbstractItemModel* model = ui->treeView->model();
|
||||
for (int i=0; i<model->rowCount(); ++i) {
|
||||
int id = model->data(model->index(i,0), Qt::UserRole).toInt();
|
||||
QString name = QString::fromLatin1("Edge%1").arg(id);
|
||||
QString name = QStringLiteral("Edge%1").arg(id);
|
||||
if (name == subelement) {
|
||||
// ok, check the selected sub-element
|
||||
Qt::CheckState checkState =
|
||||
@@ -469,7 +469,7 @@ void DlgFilletEdges::onSelectEdgesOfFace(const QString& subelement, int type)
|
||||
for(int j = 1; j <= mapOfEdges.Extent(); ++j) {
|
||||
TopoDS_Edge edge = TopoDS::Edge(mapOfEdges.FindKey(j));
|
||||
int id = d->all_edges.FindIndex(edge);
|
||||
QString name = QString::fromLatin1("Edge%1").arg(id);
|
||||
QString name = QStringLiteral("Edge%1").arg(id);
|
||||
onSelectEdge(name, type);
|
||||
Gui::SelectionChanges::MsgType msgType = Gui::SelectionChanges::MsgType(type);
|
||||
if (msgType == Gui::SelectionChanges::AddSelection) {
|
||||
@@ -534,7 +534,7 @@ void DlgFilletEdges::toggleCheckState(const QModelIndex& index)
|
||||
return;
|
||||
QVariant check = index.data(Qt::CheckStateRole);
|
||||
int id = index.data(Qt::UserRole).toInt();
|
||||
QString name = QString::fromLatin1("Edge%1").arg(id);
|
||||
QString name = QStringLiteral("Edge%1").arg(id);
|
||||
Qt::CheckState checkState = static_cast<Qt::CheckState>(check.toInt());
|
||||
|
||||
bool block = this->blockSelection(true);
|
||||
@@ -973,7 +973,7 @@ bool DlgFilletEdges::accept()
|
||||
std::string fillet = getFilletType();
|
||||
int index = ui->shapeObject->currentIndex();
|
||||
shape = ui->shapeObject->itemData(index).toString();
|
||||
type = QString::fromLatin1("Part::%1").arg(QString::fromLatin1(fillet.c_str()));
|
||||
type = QStringLiteral("Part::%1").arg(QString::fromLatin1(fillet.c_str()));
|
||||
|
||||
if (d->fillet)
|
||||
name = QString::fromLatin1(d->fillet->getNameInDocument());
|
||||
@@ -983,12 +983,12 @@ bool DlgFilletEdges::accept()
|
||||
activeDoc->openTransaction(fillet.c_str());
|
||||
QString code;
|
||||
if (!d->fillet) {
|
||||
code = QString::fromLatin1(
|
||||
code = QStringLiteral(
|
||||
"FreeCAD.ActiveDocument.addObject(\"%1\",\"%2\")\n"
|
||||
"FreeCAD.ActiveDocument.%2.Base = FreeCAD.ActiveDocument.%3\n")
|
||||
.arg(type, name, shape);
|
||||
}
|
||||
code += QString::fromLatin1("__fillets__ = []\n");
|
||||
code += QStringLiteral("__fillets__ = []\n");
|
||||
for (int i=0; i<model->rowCount(); ++i) {
|
||||
QVariant value = model->index(i,0).data(Qt::CheckStateRole);
|
||||
Qt::CheckState checkState = static_cast<Qt::CheckState>(value.toInt());
|
||||
@@ -1001,7 +1001,7 @@ bool DlgFilletEdges::accept()
|
||||
Base::Quantity r2 = r1;
|
||||
if (end_radius)
|
||||
r2 = model->index(i,2).data(Qt::EditRole).value<Base::Quantity>();
|
||||
code += QString::fromLatin1(
|
||||
code += QStringLiteral(
|
||||
"__fillets__.append((%1,%2,%3))\n")
|
||||
.arg(id)
|
||||
.arg(r1.getValue(),0,'f',Base::UnitsApi::getDecimals())
|
||||
@@ -1018,7 +1018,7 @@ bool DlgFilletEdges::accept()
|
||||
}
|
||||
|
||||
Gui::WaitCursor wc;
|
||||
code += QString::fromLatin1(
|
||||
code += QStringLiteral(
|
||||
"FreeCAD.ActiveDocument.%1.Edges = __fillets__\n"
|
||||
"del __fillets__\n"
|
||||
"FreeCADGui.ActiveDocument.%2.Visibility = False\n")
|
||||
|
||||
@@ -63,7 +63,7 @@ void DlgPartImportIgesImp::OnApply()
|
||||
void DlgPartImportIgesImp::onChooseFileName()
|
||||
{
|
||||
QString fn = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), QString(), QString(),
|
||||
QString::fromLatin1("%1 (*.igs *.iges);;%2 (*.*)"))
|
||||
QStringLiteral("%1 (*.igs *.iges);;%2 (*.*)"))
|
||||
.arg(tr("IGES"),
|
||||
tr("All Files"));
|
||||
if (!fn.isEmpty()) {
|
||||
|
||||
@@ -63,7 +63,7 @@ void DlgPartImportStepImp::OnApply()
|
||||
void DlgPartImportStepImp::onChooseFileName()
|
||||
{
|
||||
QString fn = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), QString(), QString(),
|
||||
QString::fromLatin1("%1 (*.stp *.step);;%2 (*.*)"))
|
||||
QStringLiteral("%1 (*.stp *.step);;%2 (*.*)"))
|
||||
.arg(QLatin1String("STEP"),
|
||||
tr("All Files"));
|
||||
if (!fn.isEmpty()) {
|
||||
|
||||
@@ -67,11 +67,11 @@ namespace PartGui {
|
||||
App::Part* activePart = Gui::Application::Instance->activeView()->getActiveObject<App::Part*>("part");
|
||||
if (activePart) {
|
||||
QString activeObjectName = QString::fromLatin1(activePart->getNameInDocument());
|
||||
return QString::fromLatin1("App.ActiveDocument.getObject('%1\')."
|
||||
return QStringLiteral("App.ActiveDocument.getObject('%1\')."
|
||||
"addObject(App.ActiveDocument.getObject('%2\'))\n")
|
||||
.arg(activeObjectName, objectName);
|
||||
}
|
||||
return QString::fromLatin1("# Object %1 created at document root").arg(objectName);
|
||||
return QStringLiteral("# Object %1 created at document root").arg(objectName);
|
||||
}
|
||||
|
||||
const char* gce_ErrorStatusText(gce_ErrorType et)
|
||||
@@ -151,7 +151,7 @@ QString Picker::toPlacement(const gp_Ax2& axis) const
|
||||
Base::Rotation rot(Base::convertTo<Base::Vector3d>(theAxis), theAngle);
|
||||
gp_Pnt loc = axis.Location();
|
||||
|
||||
return QString::fromLatin1("Base.Placement(Base.Vector(%1,%2,%3),Base.Rotation(%4,%5,%6,%7))")
|
||||
return QStringLiteral("Base.Placement(Base.Vector(%1,%2,%3),Base.Rotation(%4,%5,%6,%7))")
|
||||
.arg(loc.X(),0,'g',Base::UnitsApi::getDecimals())
|
||||
.arg(loc.Y(),0,'g',Base::UnitsApi::getDecimals())
|
||||
.arg(loc.Z(),0,'g',Base::UnitsApi::getDecimals())
|
||||
@@ -182,7 +182,7 @@ public:
|
||||
Handle(Geom_Circle) circle = Handle(Geom_Circle)::DownCast(trim->BasisCurve());
|
||||
|
||||
QString name = QString::fromLatin1(doc->getUniqueObjectName("Circle").c_str());
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"App.ActiveDocument.addObject(\"Part::Circle\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Radius=%2\n"
|
||||
"App.ActiveDocument.%1.Angle1=%3\n"
|
||||
@@ -266,7 +266,7 @@ const char* PlanePrimitive::getDefaultName() const
|
||||
|
||||
QString PlanePrimitive::create(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"App.ActiveDocument.addObject(\"Part::Plane\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Length='%2'\n"
|
||||
"App.ActiveDocument.%1.Width='%3'\n"
|
||||
@@ -281,7 +281,7 @@ QString PlanePrimitive::create(const QString& objectName, const QString& placeme
|
||||
|
||||
QString PlanePrimitive::change(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"%1.Length='%2'\n"
|
||||
"%1.Width='%3'\n"
|
||||
"%1.Placement=%4\n")
|
||||
@@ -339,7 +339,7 @@ const char* BoxPrimitive::getDefaultName() const
|
||||
|
||||
QString BoxPrimitive::create(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"App.ActiveDocument.addObject(\"Part::Box\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Length='%2'\n"
|
||||
"App.ActiveDocument.%1.Width='%3'\n"
|
||||
@@ -356,7 +356,7 @@ QString BoxPrimitive::create(const QString& objectName, const QString& placement
|
||||
|
||||
QString BoxPrimitive::change(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"%1.Length='%2'\n"
|
||||
"%1.Width='%3'\n"
|
||||
"%1.Height='%4'\n"
|
||||
@@ -425,7 +425,7 @@ const char* CylinderPrimitive::getDefaultName() const
|
||||
|
||||
QString CylinderPrimitive::create(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"App.ActiveDocument.addObject(\"Part::Cylinder\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Radius='%2'\n"
|
||||
"App.ActiveDocument.%1.Height='%3'\n"
|
||||
@@ -446,7 +446,7 @@ QString CylinderPrimitive::create(const QString& objectName, const QString& plac
|
||||
|
||||
QString CylinderPrimitive::change(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"%1.Radius='%2'\n"
|
||||
"%1.Height='%3'\n"
|
||||
"%1.Angle='%4'\n"
|
||||
@@ -523,7 +523,7 @@ const char* ConePrimitive::getDefaultName() const
|
||||
|
||||
QString ConePrimitive::create(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"App.ActiveDocument.addObject(\"Part::Cone\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Radius1='%2'\n"
|
||||
"App.ActiveDocument.%1.Radius2='%3'\n"
|
||||
@@ -542,7 +542,7 @@ QString ConePrimitive::create(const QString& objectName, const QString& placemen
|
||||
|
||||
QString ConePrimitive::change(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"%1.Radius1='%2'\n"
|
||||
"%1.Radius2='%3'\n"
|
||||
"%1.Height='%4'\n"
|
||||
@@ -614,7 +614,7 @@ const char* SpherePrimitive::getDefaultName() const
|
||||
|
||||
QString SpherePrimitive::create(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"App.ActiveDocument.addObject(\"Part::Sphere\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Radius='%2'\n"
|
||||
"App.ActiveDocument.%1.Angle1='%3'\n"
|
||||
@@ -633,7 +633,7 @@ QString SpherePrimitive::create(const QString& objectName, const QString& placem
|
||||
|
||||
QString SpherePrimitive::change(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"%1.Radius='%2'\n"
|
||||
"%1.Angle1='%3'\n"
|
||||
"%1.Angle2='%4'\n"
|
||||
@@ -714,7 +714,7 @@ const char* EllipsoidPrimitive::getDefaultName() const
|
||||
|
||||
QString EllipsoidPrimitive::create(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"App.ActiveDocument.addObject(\"Part::Ellipsoid\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Radius1='%2'\n"
|
||||
"App.ActiveDocument.%1.Radius2='%3'\n"
|
||||
@@ -737,7 +737,7 @@ QString EllipsoidPrimitive::create(const QString& objectName, const QString& pla
|
||||
|
||||
QString EllipsoidPrimitive::change(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"%1.Radius1='%2'\n"
|
||||
"%1.Radius2='%3'\n"
|
||||
"%1.Radius3='%4'\n"
|
||||
@@ -823,7 +823,7 @@ const char* TorusPrimitive::getDefaultName() const
|
||||
|
||||
QString TorusPrimitive::create(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"App.ActiveDocument.addObject(\"Part::Torus\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Radius1='%2'\n"
|
||||
"App.ActiveDocument.%1.Radius2='%3'\n"
|
||||
@@ -844,7 +844,7 @@ QString TorusPrimitive::create(const QString& objectName, const QString& placeme
|
||||
|
||||
QString TorusPrimitive::change(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"%1.Radius1='%2'\n"
|
||||
"%1.Radius2='%3'\n"
|
||||
"%1.Angle1='%4'\n"
|
||||
@@ -921,7 +921,7 @@ const char* PrismPrimitive::getDefaultName() const
|
||||
|
||||
QString PrismPrimitive::create(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"App.ActiveDocument.addObject(\"Part::Prism\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Polygon=%2\n"
|
||||
"App.ActiveDocument.%1.Circumradius='%3'\n"
|
||||
@@ -942,7 +942,7 @@ QString PrismPrimitive::create(const QString& objectName, const QString& placeme
|
||||
|
||||
QString PrismPrimitive::change(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"%1.Polygon=%2\n"
|
||||
"%1.Circumradius='%3'\n"
|
||||
"%1.Height='%4'\n"
|
||||
@@ -1053,7 +1053,7 @@ const char* WedgePrimitive::getDefaultName() const
|
||||
|
||||
QString WedgePrimitive::create(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"App.ActiveDocument.addObject(\"Part::Wedge\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Xmin='%2'\n"
|
||||
"App.ActiveDocument.%1.Ymin='%3'\n"
|
||||
@@ -1084,7 +1084,7 @@ QString WedgePrimitive::create(const QString& objectName, const QString& placeme
|
||||
|
||||
QString WedgePrimitive::change(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"%1.Xmin='%2'\n"
|
||||
"%1.Ymin='%3'\n"
|
||||
"%1.Zmin='%4'\n"
|
||||
@@ -1188,7 +1188,7 @@ const char* HelixPrimitive::getDefaultName() const
|
||||
|
||||
QString HelixPrimitive::create(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"App.ActiveDocument.addObject(\"Part::Helix\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Pitch='%2'\n"
|
||||
"App.ActiveDocument.%1.Height='%3'\n"
|
||||
@@ -1210,7 +1210,7 @@ QString HelixPrimitive::create(const QString& objectName, const QString& placeme
|
||||
|
||||
QString HelixPrimitive::change(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"%1.Pitch='%2'\n"
|
||||
"%1.Height='%3'\n"
|
||||
"%1.Radius='%4'\n"
|
||||
@@ -1282,7 +1282,7 @@ const char* SpiralPrimitive::getDefaultName() const
|
||||
|
||||
QString SpiralPrimitive::create(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"App.ActiveDocument.addObject(\"Part::Spiral\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Growth='%2'\n"
|
||||
"App.ActiveDocument.%1.Rotations=%3\n"
|
||||
@@ -1299,7 +1299,7 @@ QString SpiralPrimitive::create(const QString& objectName, const QString& placem
|
||||
|
||||
QString SpiralPrimitive::change(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"%1.Growth='%2'\n"
|
||||
"%1.Rotations=%3\n"
|
||||
"%1.Radius='%4'\n"
|
||||
@@ -1362,7 +1362,7 @@ const char* CirclePrimitive::getDefaultName() const
|
||||
|
||||
QString CirclePrimitive::create(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"App.ActiveDocument.addObject(\"Part::Circle\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Radius='%2'\n"
|
||||
"App.ActiveDocument.%1.Angle1='%3'\n"
|
||||
@@ -1379,7 +1379,7 @@ QString CirclePrimitive::create(const QString& objectName, const QString& placem
|
||||
|
||||
QString CirclePrimitive::change(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"%1.Radius='%2'\n"
|
||||
"%1.Angle1='%3'\n"
|
||||
"%1.Angle2='%4'\n"
|
||||
@@ -1446,7 +1446,7 @@ const char* EllipsePrimitive::getDefaultName() const
|
||||
|
||||
QString EllipsePrimitive::create(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"App.ActiveDocument.addObject(\"Part::Ellipse\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.MajorRadius='%2'\n"
|
||||
"App.ActiveDocument.%1.MinorRadius='%3'\n"
|
||||
@@ -1465,7 +1465,7 @@ QString EllipsePrimitive::create(const QString& objectName, const QString& place
|
||||
|
||||
QString EllipsePrimitive::change(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"%1.MajorRadius='%2'\n"
|
||||
"%1.MinorRadius='%3'\n"
|
||||
"%1.Angle1='%4'\n"
|
||||
@@ -1527,7 +1527,7 @@ const char* PolygonPrimitive::getDefaultName() const
|
||||
|
||||
QString PolygonPrimitive::create(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"App.ActiveDocument.addObject(\"Part::RegularPolygon\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.Polygon=%2\n"
|
||||
"App.ActiveDocument.%1.Circumradius='%3'\n"
|
||||
@@ -1542,7 +1542,7 @@ QString PolygonPrimitive::create(const QString& objectName, const QString& place
|
||||
|
||||
QString PolygonPrimitive::change(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"%1.Polygon=%2\n"
|
||||
"%1.Circumradius='%3'\n"
|
||||
"%1.Placement=%4\n")
|
||||
@@ -1618,7 +1618,7 @@ const char* LinePrimitive::getDefaultName() const
|
||||
|
||||
QString LinePrimitive::create(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"App.ActiveDocument.addObject(\"Part::Line\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.X1='%2'\n"
|
||||
"App.ActiveDocument.%1.Y1='%3'\n"
|
||||
@@ -1641,7 +1641,7 @@ QString LinePrimitive::create(const QString& objectName, const QString& placemen
|
||||
|
||||
QString LinePrimitive::change(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"%1.X1='%2'\n"
|
||||
"%1.Y1='%3'\n"
|
||||
"%1.Z1='%4'\n"
|
||||
@@ -1722,7 +1722,7 @@ const char* VertexPrimitive::getDefaultName() const
|
||||
|
||||
QString VertexPrimitive::create(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"App.ActiveDocument.addObject(\"Part::Vertex\",\"%1\")\n"
|
||||
"App.ActiveDocument.%1.X='%2'\n"
|
||||
"App.ActiveDocument.%1.Y='%3'\n"
|
||||
@@ -1739,7 +1739,7 @@ QString VertexPrimitive::create(const QString& objectName, const QString& placem
|
||||
|
||||
QString VertexPrimitive::change(const QString& objectName, const QString& placement) const
|
||||
{
|
||||
return QString::fromLatin1(
|
||||
return QStringLiteral(
|
||||
"%1.X='%2'\n"
|
||||
"%1.Y='%3'\n"
|
||||
"%1.Z='%4'\n"
|
||||
@@ -1949,7 +1949,7 @@ void DlgPrimitives::createPrimitive(const QString& placement)
|
||||
void DlgPrimitives::acceptChanges(const QString& placement)
|
||||
{
|
||||
App::Document* doc = featurePtr->getDocument();
|
||||
QString objectName = QString::fromLatin1("App.getDocument(\"%1\").%2")
|
||||
QString objectName = QStringLiteral("App.getDocument(\"%1\").%2")
|
||||
.arg(QString::fromLatin1(doc->getName()),
|
||||
QString::fromLatin1(featurePtr->getNameInDocument()));
|
||||
|
||||
@@ -2174,7 +2174,7 @@ QString Location::toPlacement() const
|
||||
loc.y = ui->YPositionQSB->rawValue();
|
||||
loc.z = ui->ZPositionQSB->rawValue();
|
||||
|
||||
return QString::fromLatin1("App.Placement(App.Vector(%1,%2,%3),App.Rotation(App.Vector(%4,%5,%6),%7))")
|
||||
return QStringLiteral("App.Placement(App.Vector(%1,%2,%3),App.Rotation(App.Vector(%4,%5,%6),%7))")
|
||||
.arg(loc.x, 0, 'f', Base::UnitsApi::getDecimals())
|
||||
.arg(loc.y, 0, 'f', Base::UnitsApi::getDecimals())
|
||||
.arg(loc.z, 0, 'f', Base::UnitsApi::getDecimals())
|
||||
|
||||
@@ -233,7 +233,7 @@ void DlgRevolution::setAxisLink(const char* objname, const char* subname)
|
||||
if(objname && strlen(objname) > 0){
|
||||
QString txt = QString::fromLatin1(objname);
|
||||
if (subname && strlen(subname) > 0){
|
||||
txt = txt + QString::fromLatin1(":") + QString::fromLatin1(subname);
|
||||
txt = txt + QStringLiteral(":") + QString::fromLatin1(subname);
|
||||
}
|
||||
ui->txtAxisLink->setText(txt);
|
||||
} else {
|
||||
@@ -377,38 +377,38 @@ void DlgRevolution::accept()
|
||||
QString shape, type, name, solid;
|
||||
QList<QTreeWidgetItem *> items = ui->treeWidget->selectedItems();
|
||||
if (ui->checkSolid->isChecked()) {
|
||||
solid = QString::fromLatin1("True");}
|
||||
solid = QStringLiteral("True");}
|
||||
else {
|
||||
solid = QString::fromLatin1("False");}
|
||||
solid = QStringLiteral("False");}
|
||||
|
||||
App::PropertyLinkSub axisLink;
|
||||
this->getAxisLink(axisLink);
|
||||
QString strAxisLink;
|
||||
if (axisLink.getValue()){
|
||||
strAxisLink = QString::fromLatin1("(App.ActiveDocument.%1, %2)")
|
||||
strAxisLink = QStringLiteral("(App.ActiveDocument.%1, %2)")
|
||||
.arg(QString::fromLatin1(axisLink.getValue()->getNameInDocument()),
|
||||
axisLink.getSubValues().size() == 1 ?
|
||||
QString::fromLatin1("\"%1\"").arg(QString::fromLatin1(axisLink.getSubValues()[0].c_str()))
|
||||
QStringLiteral("\"%1\"").arg(QString::fromLatin1(axisLink.getSubValues()[0].c_str()))
|
||||
: QString() );
|
||||
} else {
|
||||
strAxisLink = QString::fromLatin1("None");
|
||||
strAxisLink = QStringLiteral("None");
|
||||
}
|
||||
|
||||
QString symmetric;
|
||||
if (ui->checkSymmetric->isChecked()) {
|
||||
symmetric = QString::fromLatin1("True");}
|
||||
symmetric = QStringLiteral("True");}
|
||||
else {
|
||||
symmetric = QString::fromLatin1("False");}
|
||||
symmetric = QStringLiteral("False");}
|
||||
|
||||
for (auto item : items) {
|
||||
shape = item->data(0, Qt::UserRole).toString();
|
||||
type = QString::fromLatin1("Part::Revolution");
|
||||
type = QStringLiteral("Part::Revolution");
|
||||
name = QString::fromLatin1(activeDoc->getUniqueObjectName("Revolve").c_str());
|
||||
Base::Vector3d axis = this->getDirection();
|
||||
Base::Vector3d pos = this->getPosition();
|
||||
|
||||
|
||||
QString code = QString::fromLatin1(
|
||||
QString code = QStringLiteral(
|
||||
"FreeCAD.ActiveDocument.addObject(\"%1\",\"%2\")\n"
|
||||
"FreeCAD.ActiveDocument.%2.Source = FreeCAD.ActiveDocument.%3\n"
|
||||
"FreeCAD.ActiveDocument.%2.Axis = (%4,%5,%6)\n"
|
||||
@@ -446,7 +446,7 @@ void DlgRevolution::accept()
|
||||
return;
|
||||
} catch (...){
|
||||
QMessageBox::critical(this, windowTitle(),
|
||||
tr("Creating Revolve failed.\n\n%1").arg(QString::fromUtf8("Unknown error")));
|
||||
tr("Creating Revolve failed.\n\n%1").arg(QStringLiteral("Unknown error")));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -226,8 +226,8 @@ void DlgScale::apply()
|
||||
name = sourceObj->getDocument()->getUniqueObjectName("Scale").c_str();
|
||||
if (addBaseName) {
|
||||
//FIXME: implement
|
||||
//QString baseName = QString::fromLatin1("Scale_%1").arg(sourceObjectName);
|
||||
//label = QString::fromLatin1("%1_Scale").arg((*it)->text(0));
|
||||
//QString baseName = QStringLiteral("Scale_%1").arg(sourceObjectName);
|
||||
//label = QStringLiteral("%1_Scale").arg((*it)->text(0));
|
||||
}
|
||||
|
||||
FCMD_OBJ_DOC_CMD(sourceObj,"addObject('Part::Scale','" << name << "')");
|
||||
@@ -257,7 +257,7 @@ void DlgScale::apply()
|
||||
}
|
||||
catch(...) {
|
||||
QMessageBox::critical(this, windowTitle(),
|
||||
tr("Creating Scale failed.\n%1").arg(QString::fromUtf8("Unknown error")));
|
||||
tr("Creating Scale failed.\n%1").arg(QStringLiteral("Unknown error")));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ DlgImportExportIges::DlgImportExportIges(QWidget* parent)
|
||||
bg->addButton(ui->radioButtonBRepOn, 1);
|
||||
|
||||
QRegularExpression rx;
|
||||
rx.setPattern(QString::fromLatin1("[\\x00-\\x7F]+"));
|
||||
rx.setPattern(QStringLiteral("[\\x00-\\x7F]+"));
|
||||
QRegularExpressionValidator* companyValidator = new QRegularExpressionValidator(ui->lineEditCompany);
|
||||
companyValidator->setRegularExpression(rx);
|
||||
ui->lineEditCompany->setValidator(companyValidator);
|
||||
|
||||
@@ -326,9 +326,9 @@ bool Mirroring::accept()
|
||||
int pos = label.indexOf(rx);
|
||||
if (pos > -1)
|
||||
label = label.left(pos);
|
||||
label.append(QString::fromLatin1(" (Mirror #%1)").arg(++count));
|
||||
label.append(QStringLiteral(" (Mirror #%1)").arg(++count));
|
||||
|
||||
QString code = QString::fromLatin1(
|
||||
QString code = QStringLiteral(
|
||||
"__doc__=FreeCAD.getDocument(\"%1\")\n"
|
||||
"__doc__.addObject(\"Part::Mirroring\")\n"
|
||||
"__doc__.ActiveObject.Source=__doc__.getObject(\"%2\")\n"
|
||||
|
||||
@@ -155,7 +155,7 @@ void SectionCut::initControls(const Base::BoundBox3d& BoundCompound)
|
||||
ui->CutColor->setColor(cutColor.asValue<QColor>());
|
||||
ui->CutTransparencyHS->setValue(int(cutTransparency));
|
||||
ui->CutTransparencyHS->setToolTip(QString::number(cutTransparency)
|
||||
+ QString::fromLatin1(" %"));
|
||||
+ QStringLiteral(" %"));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -302,7 +302,7 @@ void SectionCut::initBooleanFragmentControls(Gui::ViewProviderGeometryObject* co
|
||||
long compoundTransparency = compoundBF->Transparency.getValue();
|
||||
ui->BFragTransparencyHS->setValue(int(compoundTransparency));
|
||||
ui->BFragTransparencyHS->setToolTip(QString::number(compoundTransparency)
|
||||
+ QString::fromLatin1(" %"));
|
||||
+ QStringLiteral(" %"));
|
||||
// Part::Cut ignores the cutbox transparency when it is set
|
||||
// to zero and the BooleanFragments transparency is not zero
|
||||
// therefore limit the cutbox transparency to 1 in this case
|
||||
@@ -467,14 +467,14 @@ void SectionCut::setAutoTransparency(int value)
|
||||
ui->CutTransparencyHS->blockSignals(true);
|
||||
ui->CutTransparencyHS->setValue(value);
|
||||
ui->CutTransparencyHS->setToolTip(QString::number(value)
|
||||
+ QString::fromLatin1(" %"));
|
||||
+ QStringLiteral(" %"));
|
||||
ui->CutTransparencyHS->blockSignals(false);
|
||||
}
|
||||
if (ui->autoBFColorCB->isChecked()) {
|
||||
ui->BFragTransparencyHS->blockSignals(true);
|
||||
ui->BFragTransparencyHS->setValue(value);
|
||||
ui->BFragTransparencyHS->setToolTip(QString::number(value)
|
||||
+ QString::fromLatin1(" %"));
|
||||
+ QStringLiteral(" %"));
|
||||
ui->BFragTransparencyHS->blockSignals(false);
|
||||
}
|
||||
}
|
||||
@@ -2097,9 +2097,9 @@ void SectionCut::changeCutBoxColors()
|
||||
|
||||
void SectionCut::onTransparencyHSMoved(int val)
|
||||
{
|
||||
ui->CutTransparencyHS->setToolTip(QString::number(val) + QString::fromLatin1(" %"));
|
||||
ui->CutTransparencyHS->setToolTip(QString::number(val) + QStringLiteral(" %"));
|
||||
// highlight the tooltip
|
||||
QToolTip::showText(QCursor::pos(), QString::number(val) + QString::fromLatin1(" %"), nullptr);
|
||||
QToolTip::showText(QCursor::pos(), QString::number(val) + QStringLiteral(" %"), nullptr);
|
||||
if (ui->groupBoxX->isChecked() || ui->groupBoxY->isChecked() || ui->groupBoxZ->isChecked()) {
|
||||
changeCutBoxColors();
|
||||
}
|
||||
@@ -2201,9 +2201,9 @@ void SectionCut::onBFragTransparencyHSMoved(int val)
|
||||
ui->CutTransparencyHS->setMinimum(0);
|
||||
}
|
||||
|
||||
ui->BFragTransparencyHS->setToolTip(QString::number(val) + QString::fromLatin1(" %"));
|
||||
ui->BFragTransparencyHS->setToolTip(QString::number(val) + QStringLiteral(" %"));
|
||||
// highlight the tooltip
|
||||
QToolTip::showText(QCursor::pos(), QString::number(val) + QString::fromLatin1(" %"), nullptr);
|
||||
QToolTip::showText(QCursor::pos(), QString::number(val) + QStringLiteral(" %"), nullptr);
|
||||
|
||||
// when there is no cut yet, there is nothing else to do
|
||||
if (ui->groupBoxX->isChecked() || ui->groupBoxY->isChecked() || ui->groupBoxZ->isChecked()) {
|
||||
|
||||
@@ -78,7 +78,7 @@ const QString makeRefString(const App::DocumentObject* obj, const std::string& s
|
||||
App::GeoFeature::resolveElement(obj, sub.c_str(), el, true);
|
||||
|
||||
return QString::fromLatin1(obj->getNameInDocument())
|
||||
+ (sub.length() > 0 ? QString::fromLatin1(":") : QString())
|
||||
+ (sub.length() > 0 ? QStringLiteral(":") : QString())
|
||||
+ QString::fromLatin1(el.oldName.c_str());
|
||||
}
|
||||
|
||||
@@ -328,7 +328,7 @@ bool TaskAttacher::updatePreview()
|
||||
}
|
||||
if (errMessage.length() > 0) {
|
||||
ui->message->setText(tr("Attachment mode failed: %1").arg(errMessage));
|
||||
ui->message->setStyleSheet(QString::fromLatin1("QLabel{color: red;}"));
|
||||
ui->message->setStyleSheet(QStringLiteral("QLabel{color: red;}"));
|
||||
}
|
||||
else {
|
||||
if (!attached) {
|
||||
@@ -338,7 +338,7 @@ bool TaskAttacher::updatePreview()
|
||||
else {
|
||||
std::vector<QString> strs = AttacherGui::getUIStrings(pcAttach->attacher().getTypeId(), eMapMode(pcAttach->MapMode.getValue()));
|
||||
ui->message->setText(tr("Attached with mode %1").arg(strs[0]));
|
||||
ui->message->setStyleSheet(QString::fromLatin1("QLabel{color: green;}"));
|
||||
ui->message->setStyleSheet(QStringLiteral("QLabel{color: green;}"));
|
||||
}
|
||||
}
|
||||
QString splmLabelText = attached ? tr("Attachment Offset (in local coordinates):") : tr("Attachment Offset (inactive - not attached):");
|
||||
@@ -592,7 +592,7 @@ void TaskAttacher::addToReference(const std::vector<SubAndObjName>& pairs)
|
||||
}
|
||||
catch (Base::Exception& e) {
|
||||
ui->message->setText(QCoreApplication::translate("Exception", e.what()));
|
||||
ui->message->setStyleSheet(QString::fromLatin1("QLabel{color: red;}"));
|
||||
ui->message->setStyleSheet(QStringLiteral("QLabel{color: red;}"));
|
||||
}
|
||||
|
||||
updateReferencesUI();
|
||||
@@ -768,7 +768,7 @@ void TaskAttacher::onRefName(const QString& text, unsigned idx)
|
||||
|
||||
QStringList parts = text.split(QChar::fromLatin1(':'));
|
||||
if (parts.length() < 2)
|
||||
parts.push_back(QString::fromLatin1(""));
|
||||
parts.push_back(QStringLiteral(""));
|
||||
// Check whether this is the name of an App::Plane or Part::Datum feature
|
||||
App::DocumentObject* obj = ViewProvider->getObject()->getDocument()->getObject(parts[0].toLatin1());
|
||||
if (!obj)
|
||||
@@ -796,21 +796,21 @@ void TaskAttacher::onRefName(const QString& text, unsigned idx)
|
||||
QRegularExpressionMatch match;
|
||||
std::stringstream ss;
|
||||
|
||||
rx.setPattern(QString::fromLatin1("^") + tr("Face") + QString::fromLatin1("(\\d+)$"));
|
||||
rx.setPattern(QStringLiteral("^") + tr("Face") + QStringLiteral("(\\d+)$"));
|
||||
if (part.indexOf(rx, 0, &match) >= 0) {
|
||||
int faceId = match.captured(1).toInt();
|
||||
ss << "Face" << faceId;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
rx.setPattern(QString::fromLatin1("^") + tr("Edge") + QString::fromLatin1("(\\d+)$"));
|
||||
rx.setPattern(QStringLiteral("^") + tr("Edge") + QStringLiteral("(\\d+)$"));
|
||||
if (part.indexOf(rx, 0, &match) >= 0) {
|
||||
int lineId = match.captured(1).toInt();
|
||||
ss << "Edge" << lineId;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
rx.setPattern(QString::fromLatin1("^") + tr("Vertex") + QString::fromLatin1("(\\d+)$"));
|
||||
rx.setPattern(QStringLiteral("^") + tr("Vertex") + QStringLiteral("(\\d+)$"));
|
||||
if (part.indexOf(rx, 0, &match) >= 0) {
|
||||
int vertexId = match.captured(1).toInt();
|
||||
ss << "Vertex" << vertexId;
|
||||
@@ -995,9 +995,9 @@ void TaskAttacher::updateListOfModes()
|
||||
QString tooltip = mstr[1];
|
||||
|
||||
if (mmode != mmDeactivated) {
|
||||
tooltip += QString::fromLatin1("\n\n%1\n%2")
|
||||
tooltip += QStringLiteral("\n\n%1\n%2")
|
||||
.arg(tr("Reference combinations:"),
|
||||
AttacherGui::getRefListForMode(pcAttach->attacher(), mmode).join(QString::fromLatin1("\n")));
|
||||
AttacherGui::getRefListForMode(pcAttach->attacher(), mmode).join(QStringLiteral("\n")));
|
||||
}
|
||||
item->setToolTip(tooltip);
|
||||
|
||||
@@ -1015,7 +1015,7 @@ void TaskAttacher::updateListOfModes()
|
||||
}
|
||||
item->setText(tr("%1 (add %2)").arg(
|
||||
item->text(),
|
||||
buf.join(QString::fromLatin1("+"))
|
||||
buf.join(QStringLiteral("+"))
|
||||
));
|
||||
}
|
||||
else {
|
||||
@@ -1133,7 +1133,7 @@ void TaskAttacher::visibilityAutomation(bool opening_not_closing)
|
||||
App::DocumentObject* editObj,
|
||||
const std::string& editSubName) {
|
||||
if (opening_not_closing) {
|
||||
QString code = QString::fromLatin1(
|
||||
QString code = QStringLiteral(
|
||||
"import Show\n"
|
||||
"from Show.Containers import isAContainer\n"
|
||||
"_tv_%4 = Show.TempoVis(App.ActiveDocument, tag= 'PartGui::TaskAttacher')\n"
|
||||
@@ -1158,7 +1158,7 @@ void TaskAttacher::visibilityAutomation(bool opening_not_closing)
|
||||
Gui::Command::runCommand(Gui::Command::Gui, code.toLatin1().constData());
|
||||
}
|
||||
else if (!postfix.empty()) {
|
||||
QString code = QString::fromLatin1(
|
||||
QString code = QStringLiteral(
|
||||
"_tv_%1.restore()\n"
|
||||
"del(_tv_%1)"
|
||||
).arg(QString::fromLatin1(postfix.c_str()));
|
||||
|
||||
@@ -915,7 +915,7 @@ void TaskCheckGeometryResults::currentRowChanged (const QModelIndex ¤t, co
|
||||
|
||||
bool TaskCheckGeometryResults::split(QString &input, QString &doc, QString &object, QString &sub)
|
||||
{
|
||||
QStringList strings = input.split(QString::fromLatin1("."));
|
||||
QStringList strings = input.split(QStringLiteral("."));
|
||||
if (strings.size() != 3)
|
||||
return false;
|
||||
doc = strings.at(0);
|
||||
|
||||
@@ -397,14 +397,14 @@ void FaceAppearances::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
|
||||
void FaceAppearances::updatePanel()
|
||||
{
|
||||
QString faces = QString::fromLatin1("[");
|
||||
QString faces = QStringLiteral("[");
|
||||
int size = d->index.size();
|
||||
for (int it : d->index) {
|
||||
faces += QString::number(it + 1);
|
||||
if (--size > 0)
|
||||
faces += QString::fromLatin1(",");
|
||||
faces += QStringLiteral(",");
|
||||
}
|
||||
faces += QString::fromLatin1("]");
|
||||
faces += QStringLiteral("]");
|
||||
|
||||
int maxWidth = d->ui->labelElement->width();
|
||||
QFontMetrics fm(d->ui->labelElement->font());
|
||||
|
||||
@@ -159,19 +159,19 @@ bool LoftWidget::accept()
|
||||
{
|
||||
QString list, solid, ruled, closed;
|
||||
if (d->ui.checkSolid->isChecked())
|
||||
solid = QString::fromLatin1("True");
|
||||
solid = QStringLiteral("True");
|
||||
else
|
||||
solid = QString::fromLatin1("False");
|
||||
solid = QStringLiteral("False");
|
||||
|
||||
if (d->ui.checkRuledSurface->isChecked())
|
||||
ruled = QString::fromLatin1("True");
|
||||
ruled = QStringLiteral("True");
|
||||
else
|
||||
ruled = QString::fromLatin1("False");
|
||||
ruled = QStringLiteral("False");
|
||||
|
||||
if (d->ui.checkClosed->isChecked())
|
||||
closed = QString::fromLatin1("True");
|
||||
closed = QStringLiteral("True");
|
||||
else
|
||||
closed = QString::fromLatin1("False");
|
||||
closed = QStringLiteral("False");
|
||||
|
||||
QTextStream str(&list);
|
||||
|
||||
@@ -188,7 +188,7 @@ bool LoftWidget::accept()
|
||||
|
||||
try {
|
||||
QString cmd;
|
||||
cmd = QString::fromLatin1(
|
||||
cmd = QStringLiteral(
|
||||
"App.getDocument('%5').addObject('Part::Loft','Loft')\n"
|
||||
"App.getDocument('%5').ActiveObject.Sections=[%1]\n"
|
||||
"App.getDocument('%5').ActiveObject.Solid=%2\n"
|
||||
|
||||
@@ -252,7 +252,7 @@ void ShapeBuilderWidget::createEdgeFromVertex()
|
||||
}
|
||||
|
||||
QString cmd;
|
||||
cmd = QString::fromLatin1(
|
||||
cmd = QStringLiteral(
|
||||
"_=Part.makeLine(%1, %2)\n"
|
||||
"if _.isNull(): raise RuntimeError('Failed to create edge')\n"
|
||||
"App.ActiveDocument.addObject('Part::Feature','Edge').Shape=_\n"
|
||||
@@ -294,7 +294,7 @@ void ShapeBuilderWidget::createWireFromEdge()
|
||||
str << "]";
|
||||
|
||||
QString cmd;
|
||||
cmd = QString::fromLatin1(
|
||||
cmd = QStringLiteral(
|
||||
"_=Part.Wire(Part.__sortEdges__(%1))\n"
|
||||
"if _.isNull(): raise RuntimeError('Failed to create a wire')\n"
|
||||
"App.ActiveDocument.addObject('Part::Feature','Wire').Shape=_\n"
|
||||
@@ -336,7 +336,7 @@ void ShapeBuilderWidget::createFaceFromVertex()
|
||||
|
||||
QString cmd;
|
||||
if (d->ui.checkPlanar->isChecked()) {
|
||||
cmd = QString::fromLatin1(
|
||||
cmd = QStringLiteral(
|
||||
"_=Part.Face(Part.makePolygon(%1, True))\n"
|
||||
"if _.isNull(): raise RuntimeError('Failed to create face')\n"
|
||||
"App.ActiveDocument.addObject('Part::Feature','Face').Shape=_\n"
|
||||
@@ -344,7 +344,7 @@ void ShapeBuilderWidget::createFaceFromVertex()
|
||||
).arg(list);
|
||||
}
|
||||
else {
|
||||
cmd = QString::fromLatin1(
|
||||
cmd = QStringLiteral(
|
||||
"_=Part.makeFilledFace(Part.makePolygon(%1, True).Edges)\n"
|
||||
"if _.isNull(): raise RuntimeError('Failed to create face')\n"
|
||||
"App.ActiveDocument.addObject('Part::Feature','Face').Shape=_\n"
|
||||
@@ -388,7 +388,7 @@ void ShapeBuilderWidget::createFaceFromEdge()
|
||||
|
||||
QString cmd;
|
||||
if (d->ui.checkPlanar->isChecked()) {
|
||||
cmd = QString::fromLatin1(
|
||||
cmd = QStringLiteral(
|
||||
"_=Part.Face(Part.Wire(Part.__sortEdges__(%1)))\n"
|
||||
"if _.isNull(): raise RuntimeError('Failed to create face')\n"
|
||||
"App.ActiveDocument.addObject('Part::Feature','Face').Shape=_\n"
|
||||
@@ -396,7 +396,7 @@ void ShapeBuilderWidget::createFaceFromEdge()
|
||||
).arg(list);
|
||||
}
|
||||
else {
|
||||
cmd = QString::fromLatin1(
|
||||
cmd = QStringLiteral(
|
||||
"_=Part.makeFilledFace(Part.__sortEdges__(%1))\n"
|
||||
"if _.isNull(): raise RuntimeError('Failed to create face')\n"
|
||||
"App.ActiveDocument.addObject('Part::Feature','Face').Shape=_\n"
|
||||
@@ -449,7 +449,7 @@ void ShapeBuilderWidget::createShellFromFace()
|
||||
|
||||
QString cmd;
|
||||
if (d->ui.checkRefine->isEnabled() && d->ui.checkRefine->isChecked()) {
|
||||
cmd = QString::fromLatin1(
|
||||
cmd = QStringLiteral(
|
||||
"_=Part.Shell(%1)\n"
|
||||
"if _.isNull(): raise RuntimeError('Failed to create shell')\n"
|
||||
"App.ActiveDocument.addObject('Part::Feature','Shell').Shape=_.removeSplitter()\n"
|
||||
@@ -457,7 +457,7 @@ void ShapeBuilderWidget::createShellFromFace()
|
||||
).arg(list);
|
||||
}
|
||||
else {
|
||||
cmd = QString::fromLatin1(
|
||||
cmd = QStringLiteral(
|
||||
"_=Part.Shell(%1)\n"
|
||||
"if _.isNull(): raise RuntimeError('Failed to create shell')\n"
|
||||
"App.ActiveDocument.addObject('Part::Feature','Shell').Shape=_\n"
|
||||
@@ -497,7 +497,7 @@ void ShapeBuilderWidget::createSolidFromShell()
|
||||
|
||||
QString cmd;
|
||||
if (d->ui.checkRefine->isEnabled() && d->ui.checkRefine->isChecked()) {
|
||||
cmd = QString::fromLatin1(
|
||||
cmd = QStringLiteral(
|
||||
"shell=%1\n"
|
||||
"if shell.ShapeType != 'Shell': raise RuntimeError('Part object is not a shell')\n"
|
||||
"_=Part.Solid(shell)\n"
|
||||
@@ -507,7 +507,7 @@ void ShapeBuilderWidget::createSolidFromShell()
|
||||
).arg(line);
|
||||
}
|
||||
else {
|
||||
cmd = QString::fromLatin1(
|
||||
cmd = QStringLiteral(
|
||||
"shell=%1\n"
|
||||
"if shell.ShapeType != 'Shell': raise RuntimeError('Part object is not a shell')\n"
|
||||
"_=Part.Solid(shell)\n"
|
||||
|
||||
@@ -315,14 +315,14 @@ bool SweepWidget::accept()
|
||||
|
||||
QString list, solid, frenet;
|
||||
if (d->ui.checkSolid->isChecked())
|
||||
solid = QString::fromLatin1("True");
|
||||
solid = QStringLiteral("True");
|
||||
else
|
||||
solid = QString::fromLatin1("False");
|
||||
solid = QStringLiteral("False");
|
||||
|
||||
if (d->ui.checkFrenet->isChecked())
|
||||
frenet = QString::fromLatin1("True");
|
||||
frenet = QStringLiteral("True");
|
||||
else
|
||||
frenet = QString::fromLatin1("False");
|
||||
frenet = QStringLiteral("False");
|
||||
|
||||
QTextStream str(&list);
|
||||
|
||||
@@ -349,7 +349,7 @@ bool SweepWidget::accept()
|
||||
try {
|
||||
Gui::WaitCursor wc;
|
||||
QString cmd;
|
||||
cmd = QString::fromLatin1(
|
||||
cmd = QStringLiteral(
|
||||
"App.getDocument('%5').addObject('Part::Sweep','Sweep')\n"
|
||||
"App.getDocument('%5').ActiveObject.Sections=[%1]\n"
|
||||
"App.getDocument('%5').ActiveObject.Spine=%2\n"
|
||||
|
||||
Reference in New Issue
Block a user