Mesh: Use QStringLiteral

This commit is contained in:
Benjamin Bræstrup Sayoc
2025-02-09 18:13:19 +01:00
parent 93f571c9f1
commit a59ad914ba
7 changed files with 57 additions and 58 deletions

View File

@@ -332,17 +332,17 @@ void CmdMeshImport::activated(int)
{
// use current path as default
QStringList filter;
filter << QString::fromLatin1("%1 (*.stl *.ast *.bms *.obj *.off *.iv *.ply *.nas *.bdf)")
filter << QStringLiteral("%1 (*.stl *.ast *.bms *.obj *.off *.iv *.ply *.nas *.bdf)")
.arg(QObject::tr("All Mesh Files"));
filter << QString::fromLatin1("%1 (*.stl)").arg(QObject::tr("Binary STL"));
filter << QString::fromLatin1("%1 (*.ast)").arg(QObject::tr("ASCII STL"));
filter << QString::fromLatin1("%1 (*.bms)").arg(QObject::tr("Binary Mesh"));
filter << QString::fromLatin1("%1 (*.obj)").arg(QObject::tr("Alias Mesh"));
filter << QString::fromLatin1("%1 (*.off)").arg(QObject::tr("Object File Format"));
filter << QString::fromLatin1("%1 (*.iv)").arg(QObject::tr("Inventor V2.1 ASCII"));
filter << QString::fromLatin1("%1 (*.ply)").arg(QObject::tr("Stanford Polygon"));
filter << QString::fromLatin1("%1 (*.nas *.bdf)").arg(QObject::tr("NASTRAN"));
filter << QString::fromLatin1("%1 (*.*)").arg(QObject::tr("All Files"));
filter << QStringLiteral("%1 (*.stl)").arg(QObject::tr("Binary STL"));
filter << QStringLiteral("%1 (*.ast)").arg(QObject::tr("ASCII STL"));
filter << QStringLiteral("%1 (*.bms)").arg(QObject::tr("Binary Mesh"));
filter << QStringLiteral("%1 (*.obj)").arg(QObject::tr("Alias Mesh"));
filter << QStringLiteral("%1 (*.off)").arg(QObject::tr("Object File Format"));
filter << QStringLiteral("%1 (*.iv)").arg(QObject::tr("Inventor V2.1 ASCII"));
filter << QStringLiteral("%1 (*.ply)").arg(QObject::tr("Stanford Polygon"));
filter << QStringLiteral("%1 (*.nas *.bdf)").arg(QObject::tr("NASTRAN"));
filter << QStringLiteral("%1 (*.*)").arg(QObject::tr("All Files"));
// Allow multi selection
QStringList fn = Gui::FileDialog::getOpenFileNames(Gui::getMainWindow(),
@@ -394,25 +394,25 @@ void CmdMeshExport::activated(int)
// clang-format off
QString dir = QString::fromUtf8(docObj->Label.getValue());
QList<QPair<QString, QByteArray> > ext;
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.stl)").arg(QObject::tr("Binary STL")), "STL");
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.stl)").arg(QObject::tr("ASCII STL")), "AST");
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.ast)").arg(QObject::tr("ASCII STL")), "AST");
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.bms)").arg(QObject::tr("Binary Mesh")), "BMS");
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.obj)").arg(QObject::tr("Alias Mesh")), "OBJ");
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.smf)").arg(QObject::tr("Simple Model Format")), "SMF");
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.off)").arg(QObject::tr("Object File Format")), "OFF");
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.iv)").arg(QObject::tr("Inventor V2.1 ascii")), "IV");
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.x3d)").arg(QObject::tr("X3D Extensible 3D")), "X3D");
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.x3dz)").arg(QObject::tr("Compressed X3D")), "X3DZ");
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.xhtml)").arg(QObject::tr("WebGL/X3D")), "X3DOM");
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.ply)").arg(QObject::tr("Stanford Polygon")), "PLY");
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.wrl *.vrml)").arg(QObject::tr("VRML V2.0")), "VRML");
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.wrz)").arg(QObject::tr("Compressed VRML 2.0")), "WRZ");
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.nas *.bdf)").arg(QObject::tr("Nastran")), "NAS");
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.py)").arg(QObject::tr("Python module def")), "PY");
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.asy)").arg(QObject::tr("Asymptote Format")), "ASY");
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.3mf)").arg(QObject::tr("3D Manufacturing Format")), "3MF");
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.*)").arg(QObject::tr("All Files")), ""); // Undefined
ext << qMakePair<QString, QByteArray>(QStringLiteral("%1 (*.stl)").arg(QObject::tr("Binary STL")), "STL");
ext << qMakePair<QString, QByteArray>(QStringLiteral("%1 (*.stl)").arg(QObject::tr("ASCII STL")), "AST");
ext << qMakePair<QString, QByteArray>(QStringLiteral("%1 (*.ast)").arg(QObject::tr("ASCII STL")), "AST");
ext << qMakePair<QString, QByteArray>(QStringLiteral("%1 (*.bms)").arg(QObject::tr("Binary Mesh")), "BMS");
ext << qMakePair<QString, QByteArray>(QStringLiteral("%1 (*.obj)").arg(QObject::tr("Alias Mesh")), "OBJ");
ext << qMakePair<QString, QByteArray>(QStringLiteral("%1 (*.smf)").arg(QObject::tr("Simple Model Format")), "SMF");
ext << qMakePair<QString, QByteArray>(QStringLiteral("%1 (*.off)").arg(QObject::tr("Object File Format")), "OFF");
ext << qMakePair<QString, QByteArray>(QStringLiteral("%1 (*.iv)").arg(QObject::tr("Inventor V2.1 ascii")), "IV");
ext << qMakePair<QString, QByteArray>(QStringLiteral("%1 (*.x3d)").arg(QObject::tr("X3D Extensible 3D")), "X3D");
ext << qMakePair<QString, QByteArray>(QStringLiteral("%1 (*.x3dz)").arg(QObject::tr("Compressed X3D")), "X3DZ");
ext << qMakePair<QString, QByteArray>(QStringLiteral("%1 (*.xhtml)").arg(QObject::tr("WebGL/X3D")), "X3DOM");
ext << qMakePair<QString, QByteArray>(QStringLiteral("%1 (*.ply)").arg(QObject::tr("Stanford Polygon")), "PLY");
ext << qMakePair<QString, QByteArray>(QStringLiteral("%1 (*.wrl *.vrml)").arg(QObject::tr("VRML V2.0")), "VRML");
ext << qMakePair<QString, QByteArray>(QStringLiteral("%1 (*.wrz)").arg(QObject::tr("Compressed VRML 2.0")), "WRZ");
ext << qMakePair<QString, QByteArray>(QStringLiteral("%1 (*.nas *.bdf)").arg(QObject::tr("Nastran")), "NAS");
ext << qMakePair<QString, QByteArray>(QStringLiteral("%1 (*.py)").arg(QObject::tr("Python module def")), "PY");
ext << qMakePair<QString, QByteArray>(QStringLiteral("%1 (*.asy)").arg(QObject::tr("Asymptote Format")), "ASY");
ext << qMakePair<QString, QByteArray>(QStringLiteral("%1 (*.3mf)").arg(QObject::tr("3D Manufacturing Format")), "3MF");
ext << qMakePair<QString, QByteArray>(QStringLiteral("%1 (*.*)").arg(QObject::tr("All Files")), ""); // Undefined
// clang-format on
QStringList filter;
for (const auto& it : ext) {
@@ -1459,7 +1459,7 @@ void CmdMeshBoundingBox::activated(int)
QString bound = qApp->translate("Mesh_BoundingBox", "Boundings of %1:")
.arg(QString::fromUtf8(it->Label.getValue()));
bound += QString::fromLatin1("\n\nMin=<%1,%2,%3>\n\nMax=<%4,%5,%6>")
bound += QStringLiteral("\n\nMin=<%1,%2,%3>\n\nMax=<%4,%5,%6>")
.arg(box.MinX)
.arg(box.MinY)
.arg(box.MinZ)

View File

@@ -97,7 +97,7 @@ void DlgDecimating::onCheckAbsoluteNumberToggled(bool on)
else {
ui->spinBoxReduction->setRange(0, 100);
ui->spinBoxReduction->setValue(ui->sliderReduction->value());
ui->spinBoxReduction->setSuffix(QString::fromLatin1("%"));
ui->spinBoxReduction->setSuffix(QStringLiteral("%"));
ui->checkAbsoluteNumber->setText(tr("Absolute number"));
connect(ui->sliderReduction,
qOverload<int>(&QSlider::valueChanged),

View File

@@ -439,9 +439,9 @@ void DlgEvaluateMeshImp::showInformation()
if (d->meshFeature) {
const MeshKernel& rMesh = d->meshFeature->Mesh.getValue().getKernel();
d->ui.textLabel4->setText(QString::fromLatin1("%1").arg(rMesh.CountFacets()));
d->ui.textLabel5->setText(QString::fromLatin1("%1").arg(rMesh.CountEdges()));
d->ui.textLabel6->setText(QString::fromLatin1("%1").arg(rMesh.CountPoints()));
d->ui.textLabel4->setText(QStringLiteral("%1").arg(rMesh.CountFacets()));
d->ui.textLabel5->setText(QStringLiteral("%1").arg(rMesh.CountEdges()));
d->ui.textLabel6->setText(QStringLiteral("%1").arg(rMesh.CountPoints()));
}
}
@@ -1278,7 +1278,7 @@ void DlgEvaluateMeshImp::onRepairAllTogetherClicked()
QMessageBox::warning(this, tr("Mesh repair"), QString::fromLatin1(e.what()));
}
catch (...) {
QMessageBox::warning(this, tr("Mesh repair"), QString::fromLatin1("Unknown error occurred."));
QMessageBox::warning(this, tr("Mesh repair"), QStringLiteral("Unknown error occurred."));
}
doc->commitCommand();

View File

@@ -98,9 +98,9 @@ GmshWidget::GmshWidget(QWidget* parent, Qt::WindowFlags fl)
d->ui.method->addItem(tr("Automatic"), static_cast<int>(Automatic));
d->ui.method->addItem(tr("Adaptive"), static_cast<int>(MeshAdapt));
d->ui.method->addItem(QString::fromLatin1("Delaunay"), static_cast<int>(Delaunay));
d->ui.method->addItem(QStringLiteral("Delaunay"), static_cast<int>(Delaunay));
d->ui.method->addItem(tr("Frontal"), static_cast<int>(FrontalDelaunay));
d->ui.method->addItem(QString::fromLatin1("BAMG"), static_cast<int>(BAMG));
d->ui.method->addItem(QStringLiteral("BAMG"), static_cast<int>(BAMG));
d->ui.method->addItem(tr("Frontal Quad"), static_cast<int>(FrontalDelaunayForQuads));
d->ui.method->addItem(tr("Parallelograms"), static_cast<int>(PackingOfParallelograms));
d->ui.method->addItem(tr("Quasi-structured Quad"), static_cast<int>(QuasiStructuredQuad));
@@ -252,8 +252,7 @@ void GmshWidget::finished(int /*exitCode*/, QProcess::ExitStatus exitStatus)
d->label->close();
}
d->ui.labelTime->setText(
QString::fromLatin1("%1 %2 ms").arg(tr("Time:")).arg(d->time.elapsed()));
d->ui.labelTime->setText(QStringLiteral("%1 %2 ms").arg(tr("Time:")).arg(d->time.elapsed()));
if (exitStatus == QProcess::NormalExit) {
loadOutput();
}

View File

@@ -190,25 +190,25 @@ ParametersDialog::ParametersDialog(std::vector<float>& val,
QPushButton* regionButton {};
regionButton = new QPushButton(this);
regionButton->setText(tr("Region"));
regionButton->setObjectName(QString::fromLatin1("region"));
regionButton->setObjectName(QStringLiteral("region"));
selectLayout->addWidget(regionButton);
QPushButton* singleButton {};
singleButton = new QPushButton(this);
singleButton->setText(tr("Triangle"));
singleButton->setObjectName(QString::fromLatin1("single"));
singleButton->setObjectName(QStringLiteral("single"));
selectLayout->addWidget(singleButton);
QPushButton* clearButton {};
clearButton = new QPushButton(this);
clearButton->setText(tr("Clear"));
clearButton->setObjectName(QString::fromLatin1("clear"));
clearButton->setObjectName(QStringLiteral("clear"));
selectLayout->addWidget(clearButton);
QPushButton* computeButton {};
computeButton = new QPushButton(this);
computeButton->setText(tr("Compute"));
computeButton->setObjectName(QString::fromLatin1("compute"));
computeButton->setObjectName(QStringLiteral("compute"));
gridLayout->addWidget(computeButton, 2, 0, 1, 1);
QDialogButtonBox* buttonBox {};
@@ -373,9 +373,9 @@ void SegmentationBestFit::onPlaneParametersClicked()
p.resize(6);
QString base = tr("Base");
QString axis = tr("Normal");
QString x = QString::fromLatin1(" x");
QString y = QString::fromLatin1(" y");
QString z = QString::fromLatin1(" z");
QString x = QStringLiteral(" x");
QString y = QStringLiteral(" y");
QString z = QStringLiteral(" z");
list.push_back(std::make_pair(base + x, p[0]));
list.push_back(std::make_pair(base + y, p[1]));
list.push_back(std::make_pair(base + z, p[2]));
@@ -399,9 +399,9 @@ void SegmentationBestFit::onCylinderParametersClicked()
QString base = tr("Base");
QString axis = tr("Axis");
QString radius = tr("Radius");
QString x = QString::fromLatin1(" x");
QString y = QString::fromLatin1(" y");
QString z = QString::fromLatin1(" z");
QString x = QStringLiteral(" x");
QString y = QStringLiteral(" y");
QString z = QStringLiteral(" z");
list.push_back(std::make_pair(base + x, p[0]));
list.push_back(std::make_pair(base + y, p[1]));
list.push_back(std::make_pair(base + z, p[2]));
@@ -426,9 +426,9 @@ void SegmentationBestFit::onSphereParametersClicked()
p.resize(4);
QString base = tr("Center");
QString radius = tr("Radius");
QString x = QString::fromLatin1(" x");
QString y = QString::fromLatin1(" y");
QString z = QString::fromLatin1(" z");
QString x = QStringLiteral(" x");
QString y = QStringLiteral(" y");
QString z = QStringLiteral(" z");
list.push_back(std::make_pair(base + x, p[0]));
list.push_back(std::make_pair(base + y, p[1]));
list.push_back(std::make_pair(base + z, p[2]));

View File

@@ -1746,8 +1746,8 @@ void ViewProviderMesh::faceInfoCallback(void* ud, SoEventCallback* cb)
static_cast<const SoPointDetail*>(faceDetail->getPoint(2))->getCoordinateIndex();
auto flag = new Gui::Flag;
flag->setText(QObject::tr("Index: %1").arg(uFacet));
QString toolTip = QString::fromLatin1("Facet index: %1\n"
"Points: <%2, %3, %4>")
QString toolTip = QStringLiteral("Facet index: %1\n"
"Points: <%2, %3, %4>")
.arg(uFacet)
.arg(point1)
.arg(point2)

View File

@@ -122,10 +122,10 @@ public:
numMax->setText(tr("X: %1\tY: %2\tZ: %3").arg(bbox.MaxX).arg(bbox.MaxY).arg(bbox.MaxZ));
}
else {
numPoints->setText(QString::fromLatin1(""));
numFacets->setText(QString::fromLatin1(""));
numMin->setText(QString::fromLatin1(""));
numMax->setText(QString::fromLatin1(""));
numPoints->setText(QStringLiteral(""));
numFacets->setText(QStringLiteral(""));
numMin->setText(QStringLiteral(""));
numMax->setText(QStringLiteral(""));
}
}