Surface: Use QStringLiteral

This commit is contained in:
Benjamin Bræstrup Sayoc
2025-02-09 18:28:50 +01:00
parent 017156ce44
commit e09698ee47
5 changed files with 42 additions and 46 deletions

View File

@@ -284,7 +284,7 @@ FillingPanel::FillingPanel(ViewProviderFilling* vp, Surface::Filling* obj)
// Create context menu
QAction* action = new QAction(tr("Remove"), this);
action->setShortcut(QString::fromLatin1("Del"));
action->setShortcut(QStringLiteral("Del"));
action->setShortcutContext(Qt::WidgetShortcut);
ui->listBoundary->addAction(action);
connect(action, &QAction::triggered, this, &FillingPanel::onDeleteEdge);
@@ -341,9 +341,8 @@ void FillingPanel::setEditedObject(Surface::Filling* fea)
App::DocumentObject* initFace = editedObject->InitialFace.getValue();
const std::vector<std::string>& subList = editedObject->InitialFace.getSubValues();
if (initFace && subList.size() == 1) {
QString text =
QString::fromLatin1("%1.%2").arg(QString::fromUtf8(initFace->Label.getValue()),
QString::fromStdString(subList.front()));
QString text = QStringLiteral("%1.%2").arg(QString::fromUtf8(initFace->Label.getValue()),
QString::fromStdString(subList.front()));
ui->lineInitFaceName->setText(text);
}
@@ -375,8 +374,8 @@ void FillingPanel::setEditedObject(Surface::Filling* fea)
QListWidgetItem* item = new QListWidgetItem(ui->listBoundary);
ui->listBoundary->addItem(item);
QString text = QString::fromLatin1("%1.%2").arg(QString::fromUtf8(obj->Label.getValue()),
QString::fromStdString(edge));
QString text = QStringLiteral("%1.%2").arg(QString::fromUtf8(obj->Label.getValue()),
QString::fromStdString(edge));
item->setText(text);
// The user data field of a list widget item
@@ -605,17 +604,14 @@ void FillingPanel::onListBoundaryItemDoubleClicked(QListWidgetItem* item)
// fill up the combo boxes
modifyBoundary(true);
ui->comboBoxFaces->addItem(tr("None"), QByteArray(""));
ui->comboBoxCont->addItem(QString::fromLatin1("C0"),
static_cast<int>(GeomAbs_C0));
ui->comboBoxCont->addItem(QString::fromLatin1("G1"),
static_cast<int>(GeomAbs_G1));
ui->comboBoxCont->addItem(QString::fromLatin1("G2"),
static_cast<int>(GeomAbs_G2));
ui->comboBoxCont->addItem(QStringLiteral("C0"), static_cast<int>(GeomAbs_C0));
ui->comboBoxCont->addItem(QStringLiteral("G1"), static_cast<int>(GeomAbs_G1));
ui->comboBoxCont->addItem(QStringLiteral("G2"), static_cast<int>(GeomAbs_G2));
TopTools_ListIteratorOfListOfShape it(adj_faces);
for (; it.More(); it.Next()) {
const TopoDS_Shape& F = it.Value();
int index = faces.FindIndex(F);
QString text = QString::fromLatin1("Face%1").arg(index);
QString text = QStringLiteral("Face%1").arg(index);
ui->comboBoxFaces->addItem(text, text.toLatin1());
}
@@ -651,9 +647,9 @@ void FillingPanel::onSelectionChanged(const Gui::SelectionChanges& msg)
checkOpenCommand();
if (selectionMode == InitFace) {
Gui::SelectionObject sel(msg);
QString text = QString::fromLatin1("%1.%2").arg(
QString::fromUtf8(sel.getObject()->Label.getValue()),
QString::fromLatin1(msg.pSubName));
QString text =
QStringLiteral("%1.%2").arg(QString::fromUtf8(sel.getObject()->Label.getValue()),
QString::fromLatin1(msg.pSubName));
ui->lineInitFaceName->setText(text);
std::vector<std::string> subList;
@@ -673,9 +669,9 @@ void FillingPanel::onSelectionChanged(const Gui::SelectionChanges& msg)
ui->listBoundary->addItem(item);
Gui::SelectionObject sel(msg);
QString text = QString::fromLatin1("%1.%2").arg(
QString::fromUtf8(sel.getObject()->Label.getValue()),
QString::fromLatin1(msg.pSubName));
QString text =
QStringLiteral("%1.%2").arg(QString::fromUtf8(sel.getObject()->Label.getValue()),
QString::fromLatin1(msg.pSubName));
item->setText(text);
QList<QVariant> data;

View File

@@ -133,7 +133,7 @@ FillingEdgePanel::FillingEdgePanel(ViewProviderFilling* vp, Surface::Filling* ob
// Create context menu
QAction* action = new QAction(tr("Remove"), this);
action->setShortcut(QString::fromLatin1("Del"));
action->setShortcut(QStringLiteral("Del"));
action->setShortcutContext(Qt::WidgetShortcut);
ui->listUnbound->addAction(action);
connect(action, &QAction::triggered, this, &FillingEdgePanel::onDeleteUnboundEdge);
@@ -213,8 +213,8 @@ void FillingEdgePanel::setEditedObject(Surface::Filling* fea)
QListWidgetItem* item = new QListWidgetItem(ui->listUnbound);
ui->listUnbound->addItem(item);
QString text = QString::fromLatin1("%1.%2").arg(QString::fromUtf8(obj->Label.getValue()),
QString::fromStdString(edge));
QString text = QStringLiteral("%1.%2").arg(QString::fromUtf8(obj->Label.getValue()),
QString::fromStdString(edge));
item->setText(text);
// The user data field of a list widget item
@@ -388,17 +388,17 @@ void FillingEdgePanel::onListUnboundItemDoubleClicked(QListWidgetItem* item)
// fill up the combo boxes
modifyBoundary(true);
ui->comboBoxUnboundFaces->addItem(tr("None"), QByteArray(""));
ui->comboBoxUnboundCont->addItem(QString::fromLatin1("C0"),
ui->comboBoxUnboundCont->addItem(QStringLiteral("C0"),
static_cast<int>(GeomAbs_C0));
ui->comboBoxUnboundCont->addItem(QString::fromLatin1("G1"),
ui->comboBoxUnboundCont->addItem(QStringLiteral("G1"),
static_cast<int>(GeomAbs_G1));
ui->comboBoxUnboundCont->addItem(QString::fromLatin1("G2"),
ui->comboBoxUnboundCont->addItem(QStringLiteral("G2"),
static_cast<int>(GeomAbs_G2));
TopTools_ListIteratorOfListOfShape it(adj_faces);
for (; it.More(); it.Next()) {
const TopoDS_Shape& F = it.Value();
int index = faces.FindIndex(F);
QString text = QString::fromLatin1("Face%1").arg(index);
QString text = QStringLiteral("Face%1").arg(index);
ui->comboBoxUnboundFaces->addItem(text, text.toLatin1());
}
@@ -437,9 +437,9 @@ void FillingEdgePanel::onSelectionChanged(const Gui::SelectionChanges& msg)
ui->listUnbound->addItem(item);
Gui::SelectionObject sel(msg);
QString text = QString::fromLatin1("%1.%2").arg(
QString::fromUtf8(sel.getObject()->Label.getValue()),
QString::fromLatin1(msg.pSubName));
QString text =
QStringLiteral("%1.%2").arg(QString::fromUtf8(sel.getObject()->Label.getValue()),
QString::fromLatin1(msg.pSubName));
item->setText(text);
QList<QVariant> data;

View File

@@ -125,7 +125,7 @@ FillingVertexPanel::FillingVertexPanel(ViewProviderFilling* vp, Surface::Filling
// Create context menu
QAction* action = new QAction(tr("Remove"), this);
action->setShortcut(QString::fromLatin1("Del"));
action->setShortcut(QStringLiteral("Del"));
action->setShortcutContext(Qt::WidgetShortcut);
ui->listFreeVertex->addAction(action);
connect(action, &QAction::triggered, this, &FillingVertexPanel::onDeleteVertex);
@@ -175,8 +175,8 @@ void FillingVertexPanel::setEditedObject(Surface::Filling* obj)
QListWidgetItem* item = new QListWidgetItem(ui->listFreeVertex);
ui->listFreeVertex->addItem(item);
QString text = QString::fromLatin1("%1.%2").arg(QString::fromUtf8((*it)->Label.getValue()),
QString::fromStdString(*jt));
QString text = QStringLiteral("%1.%2").arg(QString::fromUtf8((*it)->Label.getValue()),
QString::fromStdString(*jt));
item->setText(text);
QList<QVariant> data;
@@ -287,9 +287,9 @@ void FillingVertexPanel::onSelectionChanged(const Gui::SelectionChanges& msg)
ui->listFreeVertex->addItem(item);
Gui::SelectionObject sel(msg);
QString text = QString::fromLatin1("%1.%2").arg(
QString::fromUtf8(sel.getObject()->Label.getValue()),
QString::fromLatin1(msg.pSubName));
QString text =
QStringLiteral("%1.%2").arg(QString::fromUtf8(sel.getObject()->Label.getValue()),
QString::fromLatin1(msg.pSubName));
item->setText(text);
QList<QVariant> data;

View File

@@ -216,7 +216,7 @@ GeomFillSurface::GeomFillSurface(ViewProviderGeomFillSurface* vp, Surface::GeomF
// Create context menu
QAction* remove = new QAction(tr("Remove"), this);
remove->setShortcut(QString::fromLatin1("Del"));
remove->setShortcut(QStringLiteral("Del"));
ui->listWidget->addAction(remove);
connect(remove, &QAction::triggered, this, &GeomFillSurface::onDeleteEdge);
@@ -307,8 +307,8 @@ void GeomFillSurface::setEditedObject(Surface::GeomFillSurface* obj)
}
ui->listWidget->addItem(item);
QString text = QString::fromLatin1("%1.%2").arg(QString::fromUtf8((*it)->Label.getValue()),
QString::fromStdString(*jt));
QString text = QStringLiteral("%1.%2").arg(QString::fromUtf8((*it)->Label.getValue()),
QString::fromStdString(*jt));
item->setText(text);
QList<QVariant> data;
@@ -486,9 +486,9 @@ void GeomFillSurface::onSelectionChanged(const Gui::SelectionChanges& msg)
ui->listWidget->addItem(item);
Gui::SelectionObject sel(msg);
QString text = QString::fromLatin1("%1.%2").arg(
QString::fromUtf8(sel.getObject()->Label.getValue()),
QString::fromLatin1(msg.pSubName));
QString text =
QStringLiteral("%1.%2").arg(QString::fromUtf8(sel.getObject()->Label.getValue()),
QString::fromLatin1(msg.pSubName));
item->setText(text);
QList<QVariant> data;

View File

@@ -326,8 +326,8 @@ void SectionsPanel::setEditedObject(Surface::Sections* fea)
QListWidgetItem* item = new QListWidgetItem(ui->listSections);
ui->listSections->addItem(item);
QString text = QString::fromLatin1("%1.%2").arg(QString::fromUtf8(obj->Label.getValue()),
QString::fromStdString(edge));
QString text = QStringLiteral("%1.%2").arg(QString::fromUtf8(obj->Label.getValue()),
QString::fromStdString(edge));
item->setText(text);
// The user data field of a list widget item
@@ -475,9 +475,9 @@ void SectionsPanel::onSelectionChanged(const Gui::SelectionChanges& msg)
ui->listSections->addItem(item);
Gui::SelectionObject sel(msg);
QString text = QString::fromLatin1("%1.%2").arg(
QString::fromUtf8(sel.getObject()->Label.getValue()),
QString::fromLatin1(msg.pSubName));
QString text =
QStringLiteral("%1.%2").arg(QString::fromUtf8(sel.getObject()->Label.getValue()),
QString::fromLatin1(msg.pSubName));
item->setText(text);
QList<QVariant> data;