(instance));
- uimb.groupBox->setTitle(uimb.groupBox->title() + QString::fromLatin1(" ")
+ uimb.groupBox->setTitle(uimb.groupBox->title() + QStringLiteral(" ")
+ ui->comboNavigationStyle->currentText());
QString descr;
descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::SELECTION));
descr.replace(QLatin1String("\n"), QLatin1String(""));
- uimb.selectionLabel->setText(QString::fromLatin1("%1").arg(descr));
+ uimb.selectionLabel->setText(QStringLiteral("%1").arg(descr));
descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::PANNING));
descr.replace(QLatin1String("\n"), QLatin1String("
"));
- uimb.panningLabel->setText(QString::fromLatin1("%1").arg(descr));
+ uimb.panningLabel->setText(QStringLiteral("%1").arg(descr));
descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::DRAGGING));
descr.replace(QLatin1String("\n"), QLatin1String("
"));
- uimb.rotationLabel->setText(QString::fromLatin1("%1").arg(descr));
+ uimb.rotationLabel->setText(QStringLiteral("%1").arg(descr));
descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::ZOOMING));
descr.replace(QLatin1String("\n"), QLatin1String("
"));
- uimb.zoomingLabel->setText(QString::fromLatin1("%1").arg(descr));
+ uimb.zoomingLabel->setText(QStringLiteral("%1").arg(descr));
dlg.exec();
}
@@ -416,7 +416,7 @@ CameraDialog::CameraDialog(QWidget* parent)
auto currentViewButton = new QPushButton(this);
currentViewButton->setText(tr("Current view"));
- currentViewButton->setObjectName(QString::fromLatin1("currentView"));
+ currentViewButton->setObjectName(QStringLiteral("currentView"));
layout->addWidget(currentViewButton, 4, 1, 2, 1);
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
diff --git a/src/Gui/PreferencePages/DlgSettingsWorkbenchesImp.cpp b/src/Gui/PreferencePages/DlgSettingsWorkbenchesImp.cpp
index b91c19a614..99b15a0659 100644
--- a/src/Gui/PreferencePages/DlgSettingsWorkbenchesImp.cpp
+++ b/src/Gui/PreferencePages/DlgSettingsWorkbenchesImp.cpp
@@ -111,7 +111,7 @@ wbListItem::wbListItem(const QString& wbName, bool enabled, bool startupWb, bool
textLabel->setEnabled(enableCheckBox->isChecked());
// 4: shortcut
- shortcutLabel = new QLabel(QString::fromLatin1("(W, %1)").arg(index + 1), this);
+ shortcutLabel = new QLabel(QStringLiteral("(W, %1)").arg(index + 1), this);
shortcutLabel->setToolTip(tr("Shortcut to activate this workbench."));
shortcutLabel->setEnabled(enableCheckBox->isChecked());
shortcutLabel->setVisible(index < 9);
@@ -188,7 +188,7 @@ void wbListItem::setStartupWb(bool val)
void wbListItem::setShortcutLabel(int index)
{
- shortcutLabel->setText(QString::fromLatin1("(W, %1)").arg(index + 1));
+ shortcutLabel->setText(QStringLiteral("(W, %1)").arg(index + 1));
shortcutLabel->setVisible(index < 9);
}
@@ -593,9 +593,9 @@ void DlgSettingsWorkbenchesImp::setStartWorkbenchComboItems()
}
{ // add special workbench to selection
- QPixmap px = Application::Instance->workbenchIcon(QString::fromLatin1("NoneWorkbench"));
- QString key = QString::fromLatin1("");
- QString value = QString::fromLatin1("$LastModule");
+ QPixmap px = Application::Instance->workbenchIcon(QStringLiteral("NoneWorkbench"));
+ QString key = QStringLiteral("");
+ QString value = QStringLiteral("$LastModule");
if (px.isNull()) {
ui->AutoloadModuleCombo->addItem(key, QVariant(value));
}
diff --git a/src/Gui/ProgressBar.cpp b/src/Gui/ProgressBar.cpp
index d8e5897756..cffff2082e 100644
--- a/src/Gui/ProgressBar.cpp
+++ b/src/Gui/ProgressBar.cpp
@@ -295,7 +295,7 @@ void SequencerBar::showRemainingTime()
QTime time( 0,0, 0);
time = time.addSecs( rest/1000 );
QString remain = Gui::ProgressBar::tr("Remaining: %1").arg(time.toString());
- QString status = QString::fromLatin1("%1\t[%2]").arg(txt, remain);
+ QString status = QStringLiteral("%1\t[%2]").arg(txt, remain);
if (thr != currentThread) {
QMetaObject::invokeMethod(getMainWindow(), "showMessage",
diff --git a/src/Gui/ProgressDialog.cpp b/src/Gui/ProgressDialog.cpp
index 3f596d62ab..90f531fb92 100644
--- a/src/Gui/ProgressDialog.cpp
+++ b/src/Gui/ProgressDialog.cpp
@@ -217,7 +217,7 @@ void SequencerDialog::showRemainingTime()
QTime time( 0,0, 0);
time = time.addSecs( rest/1000 );
QString remain = Gui::ProgressDialog::tr("Remaining: %1").arg(time.toString());
- QString status = QString::fromLatin1("%1\t[%2]").arg(txt, remain);
+ QString status = QStringLiteral("%1\t[%2]").arg(txt, remain);
if (thr != currentThread) {
QMetaObject::invokeMethod(d->dlg, "setLabelText",
diff --git a/src/Gui/PropertyView.cpp b/src/Gui/PropertyView.cpp
index ee33bd8ca7..9f1094243e 100644
--- a/src/Gui/PropertyView.cpp
+++ b/src/Gui/PropertyView.cpp
@@ -79,7 +79,7 @@ PropertyView::PropertyView(QWidget *parent)
connect(timer, &QTimer::timeout, this, &PropertyView::onTimer);
tabs = new QTabWidget (this);
- tabs->setObjectName(QString::fromUtf8("propertyTab"));
+ tabs->setObjectName(QStringLiteral("propertyTab"));
tabs->setTabPosition(QTabWidget::South);
pLayout->addWidget(tabs, 0, 0);
diff --git a/src/Gui/PythonConsole.cpp b/src/Gui/PythonConsole.cpp
index f6b566c5a4..bed38eb94f 100644
--- a/src/Gui/PythonConsole.cpp
+++ b/src/Gui/PythonConsole.cpp
@@ -468,7 +468,7 @@ PythonConsole::PythonConsole(QWidget *parent)
const char* version = PyUnicode_AsUTF8(PySys_GetObject("version"));
const char* platform = PyUnicode_AsUTF8(PySys_GetObject("platform"));
- d->info = QString::fromLatin1("Python %1 on %2\n"
+ d->info = QStringLiteral("Python %1 on %2\n"
"Type 'help', 'copyright', 'credits' or 'license' for more information.")
.arg(QString::fromLatin1(version), QString::fromLatin1(platform));
d->output = d->info;
@@ -609,7 +609,7 @@ void PythonConsole::keyPressEvent(QKeyEvent * e)
if (!inputStrg.isEmpty())
{
d->history.append( QLatin1String("# ") + inputStrg ); //< put commented string to history ...
- inputLineBegin.insertText( QString::fromLatin1("# ") ); //< and comment it on console
+ inputLineBegin.insertText( QStringLiteral("# ") ); //< and comment it on console
setTextCursor( inputLineBegin );
printPrompt(d->interpreter->hasPendingInput() //< print adequate prompt
? PythonConsole::Incomplete
@@ -753,10 +753,10 @@ void PythonConsole::printPrompt(PythonConsole::Prompt mode)
switch (mode)
{
case PythonConsole::Incomplete:
- cursor.insertText(QString::fromLatin1("... "));
+ cursor.insertText(QStringLiteral("... "));
break;
case PythonConsole::Complete:
- cursor.insertText(QString::fromLatin1(">>> "));
+ cursor.insertText(QStringLiteral(">>> "));
break;
default:
break;
@@ -806,7 +806,7 @@ void PythonConsole::runSource(const QString& line)
}
if (d->interpreter->isOccupied()) {
- insertPythonError(QString::fromLatin1("Previous command still running!"));
+ insertPythonError(QStringLiteral("Previous command still running!"));
return;
}
@@ -1000,7 +1000,7 @@ void PythonConsole::dropEvent (QDropEvent * e)
for (int i=0; i> action;
- printStatement(QString::fromLatin1("Gui.runCommand(\"%1\")").arg(action));
+ printStatement(QStringLiteral("Gui.runCommand(\"%1\")").arg(action));
}
e->setDropAction(Qt::CopyAction);
@@ -1305,7 +1305,7 @@ void PythonConsole::contextMenuEvent ( QContextMenuEvent * e )
bool mayPasteHere = cursorBeyond( this->textCursor(), this->inputBegin() );
a = menu.addAction(tr("&Copy"), this, &PythonConsole::copy);
- a->setShortcut(QKeySequence(QString::fromLatin1("CTRL+C")));
+ a->setShortcut(QKeySequence(QStringLiteral("CTRL+C")));
a->setEnabled(textCursor().hasSelection());
a = menu.addAction(tr("&Copy command"), this, &PythonConsole::onCopyCommand);
@@ -1325,12 +1325,12 @@ void PythonConsole::contextMenuEvent ( QContextMenuEvent * e )
menu.addSeparator();
a = menu.addAction(tr("&Paste"), this, &PythonConsole::paste);
- a->setShortcut(QKeySequence(QString::fromLatin1("CTRL+V")));
+ a->setShortcut(QKeySequence(QStringLiteral("CTRL+V")));
const QMimeData *md = QApplication::clipboard()->mimeData();
a->setEnabled( mayPasteHere && md && canInsertFromMimeData(md));
a = menu.addAction(tr("Select All"), this, &PythonConsole::selectAll);
- a->setShortcut(QKeySequence(QString::fromLatin1("CTRL+A")));
+ a->setShortcut(QKeySequence(QStringLiteral("CTRL+A")));
a->setEnabled(!document()->isEmpty());
a = menu.addAction(tr("Clear console"), this, &PythonConsole::onClearConsole);
@@ -1365,7 +1365,7 @@ void PythonConsole::onSaveHistoryAs()
QString cMacroPath = QString::fromUtf8(getDefaultParameter()->GetGroup( "Macro" )->
GetASCII("MacroPath",App::Application::getUserMacroDir().c_str()).c_str());
QString fn = FileDialog::getSaveFileName(this, tr("Save History"), cMacroPath,
- QString::fromLatin1("%1 (*.FCMacro *.py)").arg(tr("Macro Files")));
+ QStringLiteral("%1 (*.FCMacro *.py)").arg(tr("Macro Files")));
if (!fn.isEmpty()) {
int dot = fn.indexOf(QLatin1Char('.'));
if (dot != -1) {
@@ -1385,7 +1385,7 @@ void PythonConsole::onSaveHistoryAs()
void PythonConsole::onInsertFileName()
{
QString fn = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), tr("Insert file name"), QString(),
- QString::fromLatin1("%1 (*.*)").arg(tr("All Files")));
+ QStringLiteral("%1 (*.*)").arg(tr("All Files")));
if ( !fn.isEmpty() ) {
insertPlainText(fn);
}
diff --git a/src/Gui/PythonEditor.cpp b/src/Gui/PythonEditor.cpp
index 3da59a5ce9..02251ec59f 100644
--- a/src/Gui/PythonEditor.cpp
+++ b/src/Gui/PythonEditor.cpp
@@ -74,13 +74,13 @@ PythonEditor::PythonEditor(QWidget* parent)
// set accelerators
auto comment = new QShortcut(this);
- comment->setKey(QKeySequence(QString::fromLatin1("ALT+C")));
+ comment->setKey(QKeySequence(QStringLiteral("ALT+C")));
auto uncomment = new QShortcut(this);
- uncomment->setKey(QKeySequence(QString::fromLatin1("ALT+U")));
+ uncomment->setKey(QKeySequence(QStringLiteral("ALT+U")));
auto execInConsole = new QShortcut(this);
- execInConsole->setKey(QKeySequence(QString::fromLatin1("ALT+SHIFT+P")));
+ execInConsole->setKey(QKeySequence(QStringLiteral("ALT+SHIFT+P")));
connect(comment, &QShortcut::activated, this, &PythonEditor::onComment);
connect(uncomment, &QShortcut::activated, this, &PythonEditor::onUncomment);
@@ -175,12 +175,12 @@ void PythonEditor::contextMenuEvent ( QContextMenuEvent * e )
if (!isReadOnly()) {
menu->addSeparator();
QAction* comment = menu->addAction( tr("Comment"), this, &PythonEditor::onComment);
- comment->setShortcut(QKeySequence(QString::fromLatin1("ALT+C")));
+ comment->setShortcut(QKeySequence(QStringLiteral("ALT+C")));
QAction* uncomment = menu->addAction( tr("Uncomment"), this, &PythonEditor::onUncomment);
- uncomment->setShortcut(QKeySequence(QString::fromLatin1("ALT+U")));
+ uncomment->setShortcut(QKeySequence(QStringLiteral("ALT+U")));
QAction* execInConsole = menu->addAction( tr("Execute in console"),
this, &PythonEditor::onExecuteInConsole);
- execInConsole->setShortcut(QKeySequence(QString::fromLatin1("ALT+Shift+P")));
+ execInConsole->setShortcut(QKeySequence(QStringLiteral("ALT+Shift+P")));
}
menu->exec(e->globalPos());
@@ -199,8 +199,8 @@ void PythonEditor::keyPressEvent(QKeyEvent* e)
ParameterGrp::handle hPrefGrp = getWindowParameter();
int indent = hPrefGrp->GetInt( "IndentSize", 4 );
bool space = hPrefGrp->GetBool( "Spaces", true );
- QString ch = space ? QString::fromLatin1(" ")
- : QString::fromLatin1("\t");
+ QString ch = space ? QStringLiteral(" ")
+ : QStringLiteral("\t");
QTextCursor cursor = textCursor();
QString currentLineText = cursor.block().text();
diff --git a/src/Gui/QSint/actionpanel/actionlabel.cpp b/src/Gui/QSint/actionpanel/actionlabel.cpp
index 7b1e60d951..e2e893fd47 100644
--- a/src/Gui/QSint/actionpanel/actionlabel.cpp
+++ b/src/Gui/QSint/actionpanel/actionlabel.cpp
@@ -85,7 +85,7 @@ QSize ActionLabel::sizeHint() const
QString s(text());
bool empty = s.isEmpty();
if (empty)
- s = QString::fromLatin1("XXXX");
+ s = QStringLiteral("XXXX");
QFontMetrics fm = fontMetrics();
QSize sz = fm.size(Qt::TextShowMnemonic, s);
w += sz.width();
diff --git a/src/Gui/QSint/actionpanel/freecadscheme.cpp b/src/Gui/QSint/actionpanel/freecadscheme.cpp
index 74a3db76c8..3c22f30de8 100644
--- a/src/Gui/QSint/actionpanel/freecadscheme.cpp
+++ b/src/Gui/QSint/actionpanel/freecadscheme.cpp
@@ -271,7 +271,7 @@ QString SystemPanelScheme::systemStyle(const QPalette& p) const
QColor actionSelectedText = p.color(QPalette::Active, QPalette::ButtonText);
QColor actionSelectedBorder = p.color(QPalette::Active, QPalette::Highlight);
- QString style = QString::fromLatin1(
+ QString style = QStringLiteral(
"QSint--ActionGroup QFrame[class='header'] {"
"border: 1px solid transparent;"
"background-color: %1;"
diff --git a/src/Gui/QuantitySpinBox.cpp b/src/Gui/QuantitySpinBox.cpp
index e881db68a2..63383a1fb4 100644
--- a/src/Gui/QuantitySpinBox.cpp
+++ b/src/Gui/QuantitySpinBox.cpp
@@ -173,7 +173,7 @@ public:
//Prep for expression parser
//This regex matches chunks between +,-,$,^ accounting for matching parenthesis.
- QRegularExpression chunkRe(QString::fromUtf8("(?<=^|[\\+\\-])((\\((?>[^()]|(?2))*\\))|[^\\+\\-\n])*(?=$|[\\+\\-])"));
+ QRegularExpression chunkRe(QStringLiteral("(?<=^|[\\+\\-])((\\((?>[^()]|(?2))*\\))|[^\\+\\-\n])*(?=$|[\\+\\-])"));
QRegularExpressionMatchIterator expressionChunk = chunkRe.globalMatch(copy);
unsigned int lengthOffset = 0;
while (expressionChunk.hasNext()) {
@@ -198,7 +198,7 @@ public:
if (fixUnitsMatch.lastCapturedIndex() == 2 || (fixUnitsMatch.lastCapturedIndex() == 3 && fixUnitsMatch.captured(3).isEmpty())){
QString matchUnits = fixUnitsMatch.captured(1);
QString matchNumbers = fixUnitsMatch.captured(2);
- copyChunk.replace(matchUnits+matchNumbers, QString::fromUtf8(")")+matchUnits+QString::fromUtf8("1(*")+matchNumbers);
+ copyChunk.replace(matchUnits+matchNumbers, QStringLiteral(")")+matchUnits+QStringLiteral("1(*")+matchNumbers);
}
}
@@ -208,7 +208,7 @@ public:
QRegularExpressionMatch match = unitsRe.match(copyChunk);
if (!match.hasMatch() && !copyChunk.isEmpty()) //If no units are found, use default units
- copyChunk.prepend(QString::fromUtf8(")")+reverseUnitStr+QString::fromUtf8("1(*")); // Add units to the end of chunk *(1unit)
+ copyChunk.prepend(QStringLiteral(")")+reverseUnitStr+QStringLiteral("1(*")); // Add units to the end of chunk *(1unit)
}
std::reverse(copyChunk.begin(), copyChunk.end());
@@ -923,7 +923,7 @@ void QuantitySpinBox::clear()
void QuantitySpinBox::selectNumber()
{
- QString expr = QString::fromLatin1("^([%1%2]?[0-9\\%3]*)\\%4?([0-9]+(%5[%1%2]?[0-9]+)?)")
+ QString expr = QStringLiteral("^([%1%2]?[0-9\\%3]*)\\%4?([0-9]+(%5[%1%2]?[0-9]+)?)")
.arg(locale().negativeSign())
.arg(locale().positiveSign())
.arg(locale().groupSeparator())
diff --git a/src/Gui/ReportView.cpp b/src/Gui/ReportView.cpp
index d81540f79b..7a61bb5933 100644
--- a/src/Gui/ReportView.cpp
+++ b/src/Gui/ReportView.cpp
@@ -64,7 +64,7 @@ ReportView::ReportView( QWidget* parent )
tabLayout->setContentsMargins( 0, 0, 0, 0 );
tabWidget = new QTabWidget( this );
- tabWidget->setObjectName(QString::fromUtf8("tabWidget"));
+ tabWidget->setObjectName(QStringLiteral("tabWidget"));
tabWidget->setTabPosition(QTabWidget::South);
tabWidget->setTabShape(QTabWidget::Rounded);
tabLayout->addWidget( tabWidget, 0, 0 );
@@ -511,7 +511,7 @@ void ReportOutput::SendLog(const std::string& notifiername, const std::string& m
if (style == ReportHighlighter::LogText) {
if (messageSize > 0 && qMsg.size()>messageSize) {
qMsg.truncate(messageSize);
- qMsg += QString::fromLatin1("...\n");
+ qMsg += QStringLiteral("...\n");
}
}
@@ -658,7 +658,7 @@ void ReportOutput::contextMenuEvent ( QContextMenuEvent * e )
QAction* copy = menu->addAction(copyStr, this, &ReportOutput::copy);
copy->setShortcut(QKeySequence(QKeySequence::Copy));
copy->setEnabled(textCursor().hasSelection());
- QIcon icon = QIcon::fromTheme(QString::fromLatin1("edit-copy"));
+ QIcon icon = QIcon::fromTheme(QStringLiteral("edit-copy"));
if (!icon.isNull())
copy->setIcon(icon);
@@ -678,7 +678,7 @@ void ReportOutput::contextMenuEvent ( QContextMenuEvent * e )
void ReportOutput::onSaveAs()
{
QString fn = QFileDialog::getSaveFileName(this, tr("Save Report Output"), QString(),
- QString::fromLatin1("%1 (*.txt *.log)").arg(tr("Plain Text Files")));
+ QStringLiteral("%1 (*.txt *.log)").arg(tr("Plain Text Files")));
if (!fn.isEmpty()) {
QFileInfo fi(fn);
if (fi.completeSuffix().isEmpty())
diff --git a/src/Gui/Selection/Selection.cpp b/src/Gui/Selection/Selection.cpp
index bef006fd72..b8fdab737e 100644
--- a/src/Gui/Selection/Selection.cpp
+++ b/src/Gui/Selection/Selection.cpp
@@ -637,7 +637,7 @@ int SelectionSingleton::setPreselect(const char* pDocName, const char* pObjectNa
} else {
msg = QCoreApplication::translate("SelectionFilter","Not allowed:");
}
- msg.append(QString::fromLatin1(" %1.%2.%3 ")
+ msg.append(QStringLiteral(" %1.%2.%3 ")
.arg(QString::fromLatin1(pDocName),
QString::fromLatin1(pObjectName),
QString::fromLatin1(pSubName)));
diff --git a/src/Gui/Selection/SelectionView.cpp b/src/Gui/Selection/SelectionView.cpp
index 3e705a2491..469f8d0f72 100644
--- a/src/Gui/Selection/SelectionView.cpp
+++ b/src/Gui/Selection/SelectionView.cpp
@@ -74,12 +74,12 @@ SelectionView::SelectionView(Gui::Document* pcDocument, QWidget* parent)
QToolButton* clearButton = new QToolButton(this);
clearButton->setFixedSize(18, 21);
clearButton->setCursor(Qt::ArrowCursor);
- clearButton->setStyleSheet(QString::fromUtf8("QToolButton {margin-bottom:1px}"));
+ clearButton->setStyleSheet(QStringLiteral("QToolButton {margin-bottom:1px}"));
clearButton->setIcon(BitmapFactory().pixmap(":/icons/edit-cleartext.svg"));
clearButton->setToolTip(tr("Clears the search field"));
clearButton->setAutoRaise(true);
countLabel = new QLabel(this);
- countLabel->setText(QString::fromUtf8("0"));
+ countLabel->setText(QStringLiteral("0"));
countLabel->setToolTip(tr("The number of selected items"));
hLayout->addWidget(searchBox);
hLayout->addWidget(clearButton, 0, Qt::AlignRight);
@@ -337,7 +337,7 @@ void SelectionView::select(QListWidgetItem* item)
// Gui::Selection().clearSelection();
Gui::Command::runCommand(Gui::Command::Gui, "Gui.Selection.clearSelection()");
// Gui::Selection().addSelection(elements[0].toLatin1(),elements[1].toLatin1(),0);
- QString cmd = QString::fromLatin1(
+ QString cmd = QStringLiteral(
R"(Gui.Selection.addSelection(App.getDocument("%1").getObject("%2")))")
.arg(elements[0], elements[1]);
Gui::Command::runCommand(Gui::Command::Gui, cmd.toLatin1());
@@ -359,7 +359,7 @@ void SelectionView::deselect()
}
// Gui::Selection().rmvSelection(elements[0].toLatin1(),elements[1].toLatin1(),0);
- QString cmd = QString::fromLatin1(
+ QString cmd = QStringLiteral(
R"(Gui.Selection.removeSelection(App.getDocument("%1").getObject("%2")))")
.arg(elements[0], elements[1]);
try {
@@ -398,14 +398,14 @@ void SelectionView::toggleSelect(QListWidgetItem* item)
}
QString cmd;
if (Gui::Selection().isSelected(docname, objname, subname)) {
- cmd = QString::fromLatin1("Gui.Selection.removeSelection("
+ cmd = QStringLiteral("Gui.Selection.removeSelection("
"App.getDocument('%1').getObject('%2'),'%3')")
.arg(QString::fromLatin1(docname),
QString::fromLatin1(objname),
QString::fromLatin1(subname));
}
else {
- cmd = QString::fromLatin1("Gui.Selection.addSelection("
+ cmd = QStringLiteral("Gui.Selection.addSelection("
"App.getDocument('%1').getObject('%2'),'%3',%4,%5,%6)")
.arg(QString::fromLatin1(docname),
QString::fromLatin1(objname),
@@ -448,7 +448,7 @@ void SelectionView::preselect(QListWidgetItem* item)
*end = 0;
}
}
- QString cmd = QString::fromLatin1("Gui.Selection.setPreselection("
+ QString cmd = QStringLiteral("Gui.Selection.setPreselection("
"App.getDocument('%1').getObject('%2'),'%3',tp=2)")
.arg(QString::fromLatin1(docname),
QString::fromLatin1(objname),
@@ -493,7 +493,7 @@ void SelectionView::touch()
if (elements.size() < 2) {
return;
}
- QString cmd = QString::fromLatin1(R"(App.getDocument("%1").getObject("%2").touch())")
+ QString cmd = QStringLiteral(R"(App.getDocument("%1").getObject("%2").touch())")
.arg(elements[0], elements[1]);
try {
Gui::Command::runCommand(Gui::Command::Doc, cmd.toLatin1());
@@ -515,7 +515,7 @@ void SelectionView::toPython()
}
try {
- QString cmd = QString::fromLatin1(R"(obj = App.getDocument("%1").getObject("%2"))")
+ QString cmd = QStringLiteral(R"(obj = App.getDocument("%1").getObject("%2"))")
.arg(elements[0], elements[1]);
Gui::Command::runCommand(Gui::Command::Gui, cmd.toLatin1());
if (elements.length() > 2) {
@@ -523,12 +523,12 @@ void SelectionView::toPython()
App::DocumentObject* obj = doc->getObject(elements[1].toLatin1());
QString property = getProperty(obj);
- cmd = QString::fromLatin1(R"(shp = App.getDocument("%1").getObject("%2").%3)")
+ cmd = QStringLiteral(R"(shp = App.getDocument("%1").getObject("%2").%3)")
.arg(elements[0], elements[1], property);
Gui::Command::runCommand(Gui::Command::Gui, cmd.toLatin1());
if (supportPart(obj, elements[2])) {
- cmd = QString::fromLatin1(R"(elt = App.getDocument("%1").getObject("%2").%3.%4)")
+ cmd = QStringLiteral(R"(elt = App.getDocument("%1").getObject("%2").%3.%4)")
.arg(elements[0], elements[1], property, elements[2]);
Gui::Command::runCommand(Gui::Command::Gui, cmd.toLatin1());
}
@@ -555,7 +555,7 @@ void SelectionView::showPart()
try {
Gui::Command::addModule(Gui::Command::Gui, module.toLatin1());
QString cmd =
- QString::fromLatin1(R"(%1.show(App.getDocument("%2").getObject("%3").%4.%5))")
+ QStringLiteral(R"(%1.show(App.getDocument("%2").getObject("%3").%4.%5))")
.arg(module, elements[0], elements[1], property, elements[2]);
Gui::Command::runCommand(Gui::Command::Gui, cmd.toLatin1());
}
@@ -637,27 +637,27 @@ void SelectionView::onItemContextMenu(const QPoint& point)
QAction* selectAction = menu.addAction(tr("Select only"), this, [&] {
this->select(nullptr);
});
- selectAction->setIcon(QIcon::fromTheme(QString::fromLatin1("view-select")));
+ selectAction->setIcon(QIcon::fromTheme(QStringLiteral("view-select")));
selectAction->setToolTip(tr("Selects only this object"));
QAction* deselectAction = menu.addAction(tr("Deselect"), this, &SelectionView::deselect);
- deselectAction->setIcon(QIcon::fromTheme(QString::fromLatin1("view-unselectable")));
+ deselectAction->setIcon(QIcon::fromTheme(QStringLiteral("view-unselectable")));
deselectAction->setToolTip(tr("Deselects this object"));
QAction* zoomAction = menu.addAction(tr("Zoom fit"), this, &SelectionView::zoom);
- zoomAction->setIcon(QIcon::fromTheme(QString::fromLatin1("zoom-fit-best")));
+ zoomAction->setIcon(QIcon::fromTheme(QStringLiteral("zoom-fit-best")));
zoomAction->setToolTip(tr("Selects and fits this object in the 3D window"));
QAction* gotoAction = menu.addAction(tr("Go to selection"), this, &SelectionView::treeSelect);
gotoAction->setToolTip(tr("Selects and locates this object in the tree view"));
QAction* touchAction = menu.addAction(tr("Mark to recompute"), this, &SelectionView::touch);
- touchAction->setIcon(QIcon::fromTheme(QString::fromLatin1("view-refresh")));
+ touchAction->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh")));
touchAction->setToolTip(tr("Mark this object to be recomputed"));
QAction* toPythonAction =
menu.addAction(tr("To Python console"), this, &SelectionView::toPython);
- toPythonAction->setIcon(QIcon::fromTheme(QString::fromLatin1("applications-python")));
+ toPythonAction->setIcon(QIcon::fromTheme(QStringLiteral("applications-python")));
toPythonAction->setToolTip(
tr("Reveals this object and its subelements in the Python console."));
@@ -666,7 +666,7 @@ void SelectionView::onItemContextMenu(const QPoint& point)
// subshape-specific entries
QAction* showPart =
menu.addAction(tr("Duplicate subshape"), this, &SelectionView::showPart);
- showPart->setIcon(QIcon(QString::fromLatin1(":/icons/ClassBrowser/member.svg")));
+ showPart->setIcon(QIcon(QStringLiteral(":/icons/ClassBrowser/member.svg")));
showPart->setToolTip(tr("Creates a standalone copy of this subshape in the document"));
}
menu.exec(selectionView->mapToGlobal(point));
diff --git a/src/Gui/SoFCCSysDragger.cpp b/src/Gui/SoFCCSysDragger.cpp
index 3d4ad6b650..39130d3b9e 100644
--- a/src/Gui/SoFCCSysDragger.cpp
+++ b/src/Gui/SoFCCSysDragger.cpp
@@ -357,7 +357,7 @@ void TDragger::drag()
Base::Unit::Length);
QString message =
- QString::fromLatin1("%1 %2").arg(QObject::tr("Translation:"), QString::fromStdString(quantity.getUserString()));
+ QStringLiteral("%1 %2").arg(QObject::tr("Translation:"), QString::fromStdString(quantity.getUserString()));
getMainWindow()->showMessage(message, 3000);
}
@@ -642,7 +642,7 @@ void TPlanarDragger::drag()
* translationIncrement.getValue(),
Base::Unit::Length);
- QString message = QString::fromLatin1("%1 %2, %3")
+ QString message = QStringLiteral("%1 %2, %3")
.arg(QObject::tr("Translation XY:"),
QString::fromStdString(quantityX.getUserString()),
QString::fromStdString(quantityY.getUserString()));
@@ -970,7 +970,7 @@ void RDragger::drag()
Base::Unit::Angle);
QString message =
- QString::fromLatin1("%1 %2").arg(QObject::tr("Rotation:"), QString::fromStdString(quantity.getUserString()));
+ QStringLiteral("%1 %2").arg(QObject::tr("Rotation:"), QString::fromStdString(quantity.getUserString()));
getMainWindow()->showMessage(message, 3000);
}
diff --git a/src/Gui/SpinBox.cpp b/src/Gui/SpinBox.cpp
index df16236b5d..cd11ec052c 100644
--- a/src/Gui/SpinBox.cpp
+++ b/src/Gui/SpinBox.cpp
@@ -68,7 +68,7 @@ void ExpressionSpinBox::bind(const App::ObjectIdentifier &_path)
void ExpressionSpinBox::showIcon()
{
int frameWidth = spinbox->style()->pixelMetric(QStyle::PM_SpinBoxFrameWidth);
- lineedit->setStyleSheet(QString::fromLatin1("QLineEdit { padding-right: %1px } ").arg(iconLabel->sizeHint().width() + frameWidth + 1));
+ lineedit->setStyleSheet(QStringLiteral("QLineEdit { padding-right: %1px } ").arg(iconLabel->sizeHint().width() + frameWidth + 1));
iconLabel->show();
}
diff --git a/src/Gui/SplashScreen.cpp b/src/Gui/SplashScreen.cpp
index 74f6768048..92bac0563c 100644
--- a/src/Gui/SplashScreen.cpp
+++ b/src/Gui/SplashScreen.cpp
@@ -260,7 +260,7 @@ QPixmap SplashScreen::splashImage()
{
// search in the UserAppData dir as very first
QPixmap splash_image;
- QFileInfo fi(QString::fromLatin1("images:splash_image.png"));
+ QFileInfo fi(QStringLiteral("images:splash_image.png"));
if (fi.isFile() && fi.exists()) {
splash_image.load(fi.filePath(), "PNG");
}
@@ -316,7 +316,7 @@ QPixmap SplashScreen::splashImage()
QString minor = QString::fromStdString(App::Application::Config()["BuildVersionMinor"]);
QString point = QString::fromStdString(App::Application::Config()["BuildVersionPoint"]);
QString suffix = QString::fromStdString(App::Application::Config()["BuildVersionSuffix"]);
- QString version = QString::fromLatin1("%1.%2.%3%4").arg(major, minor, point, suffix);
+ QString version = QStringLiteral("%1.%2.%3%4").arg(major, minor, point, suffix);
QString position, fontFamily;
std::map::const_iterator te =
diff --git a/src/Gui/StartupProcess.cpp b/src/Gui/StartupProcess.cpp
index e992c2d37c..3d7141cbe3 100644
--- a/src/Gui/StartupProcess.cpp
+++ b/src/Gui/StartupProcess.cpp
@@ -135,7 +135,7 @@ void StartupProcess::setStyleSheetPaths()
(App::Application::getUserAppDataDir() + "Gui/Stylesheets/").c_str())
<< QString::fromUtf8((App::Application::getResourceDir() + "Gui/Stylesheets/").c_str())
<< QLatin1String(":/stylesheets");
- QDir::setSearchPaths(QString::fromLatin1("qss"), qssPaths);
+ QDir::setSearchPaths(QStringLiteral("qss"), qssPaths);
// setup the search paths for Qt overlay style sheets
QStringList qssOverlayPaths;
qssOverlayPaths << QString::fromUtf8((App::Application::getUserAppDataDir()
@@ -152,7 +152,7 @@ void StartupProcess::setImagePaths()
imagePaths << QString::fromUtf8((App::Application::getUserAppDataDir() + "Gui/images").c_str())
<< QString::fromUtf8((App::Application::getUserAppDataDir() + "pixmaps").c_str())
<< QLatin1String(":/icons");
- QDir::setSearchPaths(QString::fromLatin1("images"), imagePaths);
+ QDir::setSearchPaths(QStringLiteral("images"), imagePaths);
}
void StartupProcess::registerEventType()
@@ -165,7 +165,7 @@ void StartupProcess::setThemePaths()
{
#if !defined(Q_OS_LINUX)
QIcon::setThemeSearchPaths(QIcon::themeSearchPaths()
- << QString::fromLatin1(":/icons/FreeCAD-default"));
+ << QStringLiteral(":/icons/FreeCAD-default"));
#endif
ParameterGrp::handle hTheme = App::GetApplication().GetParameterGroupByPath(
diff --git a/src/Gui/TextDocumentEditorView.cpp b/src/Gui/TextDocumentEditorView.cpp
index ef859f6a76..c9b40768e4 100644
--- a/src/Gui/TextDocumentEditorView.cpp
+++ b/src/Gui/TextDocumentEditorView.cpp
@@ -115,7 +115,7 @@ void TextDocumentEditorView::textChanged()
void TextDocumentEditorView::labelChanged()
{
- setWindowTitle(QString::fromUtf8(textDocument->Label.getValue()) + QString::fromLatin1("[*]"));
+ setWindowTitle(QString::fromUtf8(textDocument->Label.getValue()) + QStringLiteral("[*]"));
}
void TextDocumentEditorView::refresh()
diff --git a/src/Gui/TextEdit.cpp b/src/Gui/TextEdit.cpp
index 5e19327e10..68ae0efd99 100644
--- a/src/Gui/TextEdit.cpp
+++ b/src/Gui/TextEdit.cpp
@@ -60,7 +60,7 @@ TextEdit::TextEdit(QWidget* parent)
//Note: Set the correct context to this shortcut as we may use several instances of this
//class at a time
auto shortcut = new QShortcut(this);
- shortcut->setKey(QKeySequence(QString::fromLatin1("CTRL+Space")));
+ shortcut->setKey(QKeySequence(QStringLiteral("CTRL+Space")));
shortcut->setContext(Qt::WidgetShortcut);
connect(shortcut, &QShortcut::activated, this, &TextEdit::complete);
@@ -502,7 +502,7 @@ void PythonTextEditor::keyPressEvent (QKeyEvent * e)
bool space = hPrefGrp->GetBool("Spaces", true);
int indent = hPrefGrp->GetInt( "IndentSize", 4 );
QString ch = space ? QString(indent, QLatin1Char(' '))
- : QString::fromLatin1("\t");
+ : QStringLiteral("\t");
QTextCursor cursor = textCursor();
if (!cursor.hasSelection()) {
diff --git a/src/Gui/TextureMapping.cpp b/src/Gui/TextureMapping.cpp
index eefaeaa0a7..72a5e565dd 100644
--- a/src/Gui/TextureMapping.cpp
+++ b/src/Gui/TextureMapping.cpp
@@ -65,7 +65,7 @@ TextureMapping::TextureMapping(QWidget* parent, Qt::WindowFlags fl)
QStringList formats;
QList qtformats = QImageReader::supportedImageFormats();
for (const auto & it : qtformats) {
- formats << QString::fromLatin1("*.%1").arg(QLatin1String(it));
+ formats << QStringLiteral("*.%1").arg(QLatin1String(it));
}
ui->fileChooser->setFilter(tr("Image files (%1)").arg(formats.join(QLatin1String(" "))));
diff --git a/src/Gui/Thumbnail.cpp b/src/Gui/Thumbnail.cpp
index c822e26c09..fed843fc83 100644
--- a/src/Gui/Thumbnail.cpp
+++ b/src/Gui/Thumbnail.cpp
@@ -113,7 +113,7 @@ void Thumbnail::SaveDocFile (Base::Writer &writer) const
if (!px.isNull()) {
// according to specification add some meta-information to the image
qint64 mt = QDateTime::currentDateTimeUtc().toSecsSinceEpoch();
- QString mtime = QString::fromLatin1("%1").arg(mt);
+ QString mtime = QStringLiteral("%1").arg(mt);
img.setText(QLatin1String("Software"), qApp->applicationName());
img.setText(QLatin1String("Thumb::Mimetype"), QLatin1String("application/x-extension-fcstd"));
img.setText(QLatin1String("Thumb::MTime"), mtime);
diff --git a/src/Gui/ToolHandler.cpp b/src/Gui/ToolHandler.cpp
index 30e92c705b..606e2527be 100644
--- a/src/Gui/ToolHandler.cpp
+++ b/src/Gui/ToolHandler.cpp
@@ -48,7 +48,7 @@ using namespace Gui;
QString ToolHandler::getCrosshairCursorSVGName() const
{
- return QString::fromLatin1("None");
+ return QStringLiteral("None");
}
bool ToolHandler::activate()
@@ -230,7 +230,7 @@ void ToolHandler::updateCursor()
{
auto cursorstring = getCrosshairCursorSVGName();
- if (cursorstring != QString::fromLatin1("None")) {
+ if (cursorstring != QStringLiteral("None")) {
setCrosshairCursor(cursorstring);
}
}
diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp
index 6dc75a87ec..03473cc240 100644
--- a/src/Gui/Tree.cpp
+++ b/src/Gui/Tree.cpp
@@ -439,7 +439,7 @@ TreeWidgetItemDelegate::TreeWidgetItemDelegate(QObject* parent)
: QStyledItemDelegate(parent)
{
artificial = new QTreeView(qobject_cast(parent));
- artificial->setObjectName(QString::fromLatin1("DocumentTreeItems"));
+ artificial->setObjectName(QStringLiteral("DocumentTreeItems"));
artificial->setFixedSize(0, 0); // ensure that it does not render
}
@@ -1201,7 +1201,7 @@ void TreeWidget::onCreateGroup()
if (this->contextItem->type() == DocumentType) {
auto docitem = static_cast(this->contextItem);
App::Document* doc = docitem->document()->getDocument();
- QString cmd = QString::fromLatin1("App.getDocument(\"%1\").addObject"
+ QString cmd = QStringLiteral("App.getDocument(\"%1\").addObject"
"(\"App::DocumentObjectGroup\",\"Group\").Label=\"%2\"")
.arg(QString::fromLatin1(doc->getName()), name);
Gui::Command::runCommand(Gui::Command::App, cmd.toUtf8());
@@ -1211,7 +1211,7 @@ void TreeWidget::onCreateGroup()
(this->contextItem);
App::DocumentObject* obj = objitem->object()->getObject();
App::Document* doc = obj->getDocument();
- QString cmd = QString::fromLatin1("App.getDocument(\"%1\").getObject(\"%2\")"
+ QString cmd = QStringLiteral("App.getDocument(\"%1\").getObject(\"%2\")"
".newObject(\"App::DocumentObjectGroup\",\"Group\").Label=\"%3\"")
.arg(QString::fromLatin1(doc->getName()),
QString::fromLatin1(obj->getNameInDocument()),
diff --git a/src/Gui/VectorListEditor.cpp b/src/Gui/VectorListEditor.cpp
index 7b43f63167..9450145b7f 100644
--- a/src/Gui/VectorListEditor.cpp
+++ b/src/Gui/VectorListEditor.cpp
@@ -116,7 +116,7 @@ QVariant VectorTableModel::data(const QModelIndex &index, int role) const
d = vectors[r].z;
if (role == Qt::DisplayRole) {
- QString str = QString::fromLatin1("%1").arg(d, 0, 'f', decimals);
+ QString str = QStringLiteral("%1").arg(d, 0, 'f', decimals);
return str;
}
diff --git a/src/Gui/View3DInventor.cpp b/src/Gui/View3DInventor.cpp
index 1364dc3b06..87e9615046 100644
--- a/src/Gui/View3DInventor.cpp
+++ b/src/Gui/View3DInventor.cpp
@@ -250,7 +250,7 @@ void View3DInventor::print()
void View3DInventor::printPdf()
{
QString filename = FileDialog::getSaveFileName(this, tr("Export PDF"), QString(),
- QString::fromLatin1("%1 (*.pdf)").arg(tr("PDF file")));
+ QStringLiteral("%1 (*.pdf)").arg(tr("PDF file")));
if (!filename.isEmpty()) {
Gui::WaitCursor wc;
QPrinter printer(QPrinter::ScreenResolution);
diff --git a/src/Gui/ViewProviderGroupExtension.cpp b/src/Gui/ViewProviderGroupExtension.cpp
index bbeb686cb2..e42bdacd4e 100644
--- a/src/Gui/ViewProviderGroupExtension.cpp
+++ b/src/Gui/ViewProviderGroupExtension.cpp
@@ -103,7 +103,7 @@ void ViewProviderGroupExtension::extensionDropObject(App::DocumentObject* obj) {
// build Python command for execution
QString cmd;
- cmd = QString::fromLatin1("App.getDocument(\"%1\").getObject(\"%2\").addObject("
+ cmd = QStringLiteral("App.getDocument(\"%1\").getObject(\"%2\").addObject("
"App.getDocument(\"%1\").getObject(\"%3\"))")
.arg(QString::fromLatin1(doc->getName()),
QString::fromLatin1(grp->getNameInDocument()),
diff --git a/src/Gui/WidgetFactory.cpp b/src/Gui/WidgetFactory.cpp
index 20c0450759..82ee5d2f27 100644
--- a/src/Gui/WidgetFactory.cpp
+++ b/src/Gui/WidgetFactory.cpp
@@ -493,7 +493,7 @@ bool PyResource::connect(const char* sender, const char* signal, PyObject* cb)
QList list = myDlg->findChildren();
QList::const_iterator it = list.cbegin();
QObject *obj;
- QString sigStr = QString::fromLatin1("2%1").arg(QString::fromLatin1(signal));
+ QString sigStr = QStringLiteral("2%1").arg(QString::fromLatin1(signal));
while ( it != list.cend() ) {
obj = *it;
diff --git a/src/Gui/Widgets.cpp b/src/Gui/Widgets.cpp
index 0d9b7383a5..3d326ee782 100644
--- a/src/Gui/Widgets.cpp
+++ b/src/Gui/Widgets.cpp
@@ -94,7 +94,7 @@ void CommandIconView::startDrag (Qt::DropActions supportedActions)
}
auto mimeData = new QMimeData;
- mimeData->setData(QString::fromLatin1("text/x-action-items"), itemData);
+ mimeData->setData(QStringLiteral("text/x-action-items"), itemData);
auto drag = new QDrag(this);
drag->setMimeData(mimeData);
@@ -428,7 +428,7 @@ void AccelLineEdit::keyPressEvent (QKeyEvent * e)
txtLine.clear();
break;
default:
- txtLine += QString::fromLatin1(",");
+ txtLine += QStringLiteral(",");
break;
}
}
@@ -524,7 +524,7 @@ void ModifierLineEdit::keyPressEvent (QKeyEvent * e)
ClearLineEdit::ClearLineEdit (QWidget * parent)
: QLineEdit(parent)
{
- clearAction = this->addAction(QIcon(QString::fromLatin1(":/icons/edit-cleartext.svg")),
+ clearAction = this->addAction(QIcon(QStringLiteral(":/icons/edit-cleartext.svg")),
QLineEdit::TrailingPosition);
connect(clearAction, &QAction::triggered, this, &ClearLineEdit::clear);
connect(this, &QLineEdit::textChanged, this, &ClearLineEdit::updateClearButton);
@@ -943,7 +943,7 @@ void StatefulLabel::registerState(const QString& state, const QColor& color,
{
QString css;
if (color.isValid())
- css = QString::fromUtf8("Gui--StatefulLabel{ color : rgba(%1,%2,%3,%4) ;}").arg(color.red()).arg(color.green()).arg(color.blue()).arg(color.alpha());
+ css = QStringLiteral("Gui--StatefulLabel{ color : rgba(%1,%2,%3,%4) ;}").arg(color.red()).arg(color.green()).arg(color.blue()).arg(color.alpha());
_availableStates[state] = { css, preferenceName };
}
@@ -952,10 +952,10 @@ void StatefulLabel::registerState(const QString& state, const QColor& fg, const
{
QString colorEntries;
if (fg.isValid())
- colorEntries.append(QString::fromUtf8("color : rgba(%1,%2,%3,%4);").arg(fg.red()).arg(fg.green()).arg(fg.blue()).arg(fg.alpha()));
+ colorEntries.append(QStringLiteral("color : rgba(%1,%2,%3,%4);").arg(fg.red()).arg(fg.green()).arg(fg.blue()).arg(fg.alpha()));
if (bg.isValid())
- colorEntries.append(QString::fromUtf8("background-color : rgba(%1,%2,%3,%4);").arg(bg.red()).arg(bg.green()).arg(bg.blue()).arg(bg.alpha()));
- QString css = QString::fromUtf8("Gui--StatefulLabel{ %1 }").arg(colorEntries);
+ colorEntries.append(QStringLiteral("background-color : rgba(%1,%2,%3,%4);").arg(bg.red()).arg(bg.green()).arg(bg.blue()).arg(bg.alpha()));
+ QString css = QStringLiteral("Gui--StatefulLabel{ %1 }").arg(colorEntries);
_availableStates[state] = { css, preferenceName };
}
@@ -1010,7 +1010,7 @@ void StatefulLabel::setState(QString state)
// Convert the stored Uint into usable color data:
unsigned int col = unsignedEntry.second;
QColor qcolor(App::Color::fromPackedRGB(col));
- this->setStyleSheet(QString::fromUtf8("Gui--StatefulLabel{ color : rgba(%1,%2,%3,%4) ;}").arg(qcolor.red()).arg(qcolor.green()).arg(qcolor.blue()).arg(qcolor.alpha()));
+ this->setStyleSheet(QStringLiteral("Gui--StatefulLabel{ color : rgba(%1,%2,%3,%4) ;}").arg(qcolor.red()).arg(qcolor.green()).arg(qcolor.blue()).arg(qcolor.alpha()));
_styleCache[state] = this->styleSheet();
return;
}
@@ -1020,7 +1020,7 @@ void StatefulLabel::setState(QString state)
auto availableStringPrefs = _parameterGroup->GetASCIIMap();
for (const auto& stringEntry : availableStringPrefs) {
if (stringEntry.first == entry->second.preferenceString) {
- QString css = QString::fromUtf8("Gui--StatefulLabel{ %1 }").arg(QString::fromStdString(stringEntry.second));
+ QString css = QStringLiteral("Gui--StatefulLabel{ %1 }").arg(QString::fromStdString(stringEntry.second));
this->setStyleSheet(css);
_styleCache[state] = this->styleSheet();
return;
@@ -1409,7 +1409,7 @@ public:
if (edit) {
QString inputText = edit->toPlainText();
if (!inputText.isEmpty()) // let pass empty input, regardless of the type, so user can void the value
- lines = inputText.split(QString::fromLatin1("\n"));
+ lines = inputText.split(QStringLiteral("\n"));
}
if (!lines.isEmpty()) {
if (type == 1) { // floats
@@ -1483,7 +1483,7 @@ void LabelEditor::setText(const QString& s)
{
this->plainText = s;
- QString text = QString::fromLatin1("[%1]").arg(this->plainText);
+ QString text = QStringLiteral("[%1]").arg(this->plainText);
lineEdit->setText(text);
}
@@ -1506,7 +1506,7 @@ void LabelEditor::changeText()
connect(buttonBox, &QDialogButtonBox::rejected, dlg, &PropertyListDialog::reject);
connect(dlg, &PropertyListDialog::accepted, this, [&] {
QString inputText = edit->toPlainText();
- QString text = QString::fromLatin1("[%1]").arg(inputText);
+ QString text = QStringLiteral("[%1]").arg(inputText);
lineEdit->setText(text);
});
@@ -1578,7 +1578,7 @@ void ExpLineEdit::bind(const ObjectIdentifier& _path) {
ExpressionBinding::bind(_path);
int frameWidth = style()->pixelMetric(QStyle::PM_SpinBoxFrameWidth);
- setStyleSheet(QString::fromLatin1("QLineEdit { padding-right: %1px } ").arg(iconLabel->sizeHint().width() + frameWidth + 1));
+ setStyleSheet(QStringLiteral("QLineEdit { padding-right: %1px } ").arg(iconLabel->sizeHint().width() + frameWidth + 1));
iconLabel->show();
}
diff --git a/src/Gui/WorkbenchSelector.cpp b/src/Gui/WorkbenchSelector.cpp
index 88c552adc6..72e02d42fd 100644
--- a/src/Gui/WorkbenchSelector.cpp
+++ b/src/Gui/WorkbenchSelector.cpp
@@ -108,7 +108,7 @@ WorkbenchTabWidget::WorkbenchTabWidget(WorkbenchGroup* aGroup, QWidget* parent)
setToolTip(aGroup->toolTip());
setStatusTip(aGroup->action()->statusTip());
setWhatsThis(aGroup->action()->whatsThis());
- setObjectName(QString::fromLatin1("WbTabBar"));
+ setObjectName(QStringLiteral("WbTabBar"));
tabBar = new WbTabBar(this);
moreButton = new QToolButton(this);
@@ -125,7 +125,7 @@ WorkbenchTabWidget::WorkbenchTabWidget(WorkbenchGroup* aGroup, QWidget* parent)
moreButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
moreButton->setPopupMode(QToolButton::InstantPopup);
moreButton->setMenu(new QMenu(moreButton));
- moreButton->setObjectName(QString::fromLatin1("WbTabBarMore"));
+ moreButton->setObjectName(QStringLiteral("WbTabBarMore"));
if (parent->inherits("QToolBar")) {
// when toolbar is created it is not yet placed in its designated area
@@ -404,7 +404,7 @@ void WorkbenchTabWidget::buildPrefMenu()
// Add disabled workbenches, sorted alphabetically.
for (auto action : wbActionGroup->getDisabledWbActions()) {
- if (action->text() == QString::fromLatin1("")) {
+ if (action->text() == QStringLiteral("")) {
continue;
}
@@ -416,7 +416,7 @@ void WorkbenchTabWidget::buildPrefMenu()
QAction* preferencesAction = menu->addAction(tr("Preferences"));
connect(preferencesAction, &QAction::triggered, this, []() {
Gui::Dialog::DlgPreferencesImp cDlg(getMainWindow());
- cDlg.activateGroupPage(QString::fromUtf8("Workbenches"), 0);
+ cDlg.activateGroupPage(QStringLiteral("Workbenches"), 0);
cDlg.exec();
});
}
diff --git a/src/Gui/propertyeditor/PropertyEditor.cpp b/src/Gui/propertyeditor/PropertyEditor.cpp
index 270f505c45..6dfa5db131 100644
--- a/src/Gui/propertyeditor/PropertyEditor.cpp
+++ b/src/Gui/propertyeditor/PropertyEditor.cpp
@@ -794,7 +794,7 @@ void PropertyEditor::contextMenuEvent(QContextMenuEvent*)
menu.addSeparator();
// the subMenu is allocated on the heap but managed by menu.
- auto subMenu = new QMenu(QString::fromLatin1("Status"), &menu);
+ auto subMenu = new QMenu(QStringLiteral("Status"), &menu);
QAction* action;
QString text;
@@ -811,7 +811,7 @@ void PropertyEditor::contextMenuEvent(QContextMenuEvent*)
do { \
_ACTION_SETUP(_name); \
if (propType & App::Prop_##_name) { \
- action->setText(text + QString::fromLatin1(" *")); \
+ action->setText(text + QStringLiteral(" *")); \
action->setChecked(true); \
} \
} while (0)
diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp
index 5ac0b03a2c..8d95ef7d84 100644
--- a/src/Gui/propertyeditor/PropertyItem.cpp
+++ b/src/Gui/propertyeditor/PropertyItem.cpp
@@ -386,7 +386,7 @@ QVariant PropertyItem::decoration(const QVariant& value) const
QString PropertyItem::asNone(const Py::Object& pyobj) const
{
Q_UNUSED(pyobj)
- return QString::fromUtf8("");
+ return QStringLiteral("");
}
QString PropertyItem::asString(const Py::Object& pyobj) const
@@ -685,7 +685,7 @@ QVariant PropertyItem::dataProperty(int role) const
}
if (role == Qt::ToolTipRole) {
QString type =
- QString::fromLatin1("Type: %1\nName: %2")
+ QStringLiteral("Type: %1\nName: %2")
.arg(QString::fromLatin1(propertyItems[0]->getTypeId().getName()), objectName());
QString doc = PropertyItem::toolTip(propertyItems[0]).toString();
@@ -999,7 +999,7 @@ QVariant PropertyIntegerItem::toString(const QVariant& v) const
if (hasExpression()) {
string +=
- QString::fromLatin1(" ( %1 )").arg(QString::fromStdString(getExpressionString()));
+ QStringLiteral(" ( %1 )").arg(QString::fromStdString(getExpressionString()));
}
return {string};
@@ -1081,7 +1081,7 @@ QVariant PropertyIntegerConstraintItem::toString(const QVariant& v) const
if (hasExpression()) {
string +=
- QString::fromLatin1(" ( %1 )").arg(QString::fromStdString(getExpressionString()));
+ QStringLiteral(" ( %1 )").arg(QString::fromStdString(getExpressionString()));
}
return {string};
@@ -1100,7 +1100,7 @@ QVariant PropertyFloatItem::toString(const QVariant& prop) const
QString data = QLocale().toString(value, 'f', decimals());
if (hasExpression()) {
- data += QString::fromLatin1(" ( %1 )").arg(QString::fromStdString(getExpressionString()));
+ data += QStringLiteral(" ( %1 )").arg(QString::fromStdString(getExpressionString()));
}
return {data};
@@ -1426,7 +1426,7 @@ public:
if (data.canConvert()) {
const Base::Vector3d& value = data.value();
- QString str = QString::fromLatin1("(%1, %2, %3)")
+ QString str = QStringLiteral("(%1, %2, %3)")
.arg(value.x, 0, 'f', decimals)
.arg(value.y, 0, 'f', decimals)
.arg(value.z, 0, 'f', decimals);
@@ -1468,12 +1468,12 @@ QVariant PropertyVectorItem::toString(const QVariant& prop) const
{
QLocale loc;
const Base::Vector3d& value = prop.value();
- QString data = QString::fromLatin1("[%1 %2 %3]")
+ QString data = QStringLiteral("[%1 %2 %3]")
.arg(loc.toString(value.x, 'f', lowPrec),
loc.toString(value.y, 'f', lowPrec),
loc.toString(value.z, 'f', lowPrec));
if (hasExpression()) {
- data += QString::fromLatin1(" ( %1 )").arg(QString::fromStdString(getExpressionString()));
+ data += QStringLiteral(" ( %1 )").arg(QString::fromStdString(getExpressionString()));
}
return {data};
}
@@ -1492,7 +1492,7 @@ void PropertyVectorItem::setValue(const QVariant& value)
return;
}
const Base::Vector3d& val = value.value();
- QString data = QString::fromLatin1("(%1, %2, %3)")
+ QString data = QStringLiteral("(%1, %2, %3)")
.arg(val.x, 0, 'g', highPrec)
.arg(val.y, 0, 'g', highPrec)
.arg(val.z, 0, 'g', highPrec);
@@ -1519,7 +1519,7 @@ void PropertyVectorItem::setEditorData(QWidget* editor, const QVariant& data) co
QLocale loc;
auto le = qobject_cast(editor);
const Base::Vector3d& value = data.value();
- QString text = QString::fromLatin1("[%1 %2 %3]")
+ QString text = QStringLiteral("[%1 %2 %3]")
.arg(loc.toString(value.x, 'f', lowPrec),
loc.toString(value.y, 'f', lowPrec),
loc.toString(value.z, 'f', lowPrec));
@@ -1657,10 +1657,10 @@ void VectorListWidget::showValue(const QVariant& d)
QString data;
const QList& value = d.value>();
if (value.isEmpty()) {
- data = QString::fromLatin1("[]");
+ data = QStringLiteral("[]");
}
else {
- data = QString::fromLatin1("[%1 %2 %3], ...")
+ data = QStringLiteral("[%1 %2 %3], ...")
.arg(loc.toString(value[0].x, 'f', lowPrec),
loc.toString(value[0].y, 'f', lowPrec),
loc.toString(value[0].z, 'f', lowPrec));
@@ -1679,17 +1679,17 @@ QVariant PropertyVectorListItem::toString(const QVariant& prop) const
QString data;
const QList& value = prop.value>();
if (value.isEmpty()) {
- data = QString::fromLatin1("[]");
+ data = QStringLiteral("[]");
}
else {
- data = QString::fromLatin1("[%1 %2 %3], ...")
+ data = QStringLiteral("[%1 %2 %3], ...")
.arg(loc.toString(value[0].x, 'f', lowPrec),
loc.toString(value[0].y, 'f', lowPrec),
loc.toString(value[0].z, 'f', lowPrec));
}
if (hasExpression()) {
- data += QString::fromLatin1(" ( %1 )").arg(QString::fromStdString(getExpressionString()));
+ data += QStringLiteral(" ( %1 )").arg(QString::fromStdString(getExpressionString()));
}
return {data};
}
@@ -1715,7 +1715,7 @@ void PropertyVectorListItem::setValue(const QVariant& value)
QTextStream str(&data);
str << "[";
for (const auto& it : val) {
- str << QString::fromLatin1("(%1, %2, %3), ")
+ str << QStringLiteral("(%1, %2, %3), ")
.arg(it.x, 0, 'g', highPrec)
.arg(it.y, 0, 'g', highPrec)
.arg(it.z, 0, 'g', highPrec);
@@ -1971,7 +1971,7 @@ QVariant PropertyMatrixItem::toString(const QVariant& prop) const
QLocale loc;
const Base::Matrix4D& value = prop.value();
// NOLINTBEGIN
- QString text = QString::fromLatin1("[%1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14 %15 %16]")
+ QString text = QStringLiteral("[%1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14 %15 %16]")
.arg(loc.toString(value[0][0], 'f', lowPrec), //(unsigned short usNdx)
loc.toString(value[0][1], 'f', lowPrec),
loc.toString(value[0][2], 'f', lowPrec),
@@ -2016,7 +2016,7 @@ void PropertyMatrixItem::setValue(const QVariant& value)
const Base::Matrix4D& val = value.value();
// NOLINTBEGIN
QString data =
- QString::fromLatin1(
+ QStringLiteral(
"FreeCAD.Matrix(%1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16)")
.arg(val[0][0], 0, 'g', highPrec)
.arg(val[0][1], 0, 'g', highPrec)
@@ -2053,7 +2053,7 @@ void PropertyMatrixItem::setEditorData(QWidget* editor, const QVariant& data) co
auto le = qobject_cast(editor);
const Base::Matrix4D& value = data.value();
// NOLINTBEGIN
- QString text = QString::fromLatin1("[%1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14 %15 %16]")
+ QString text = QStringLiteral("[%1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14 %15 %16]")
.arg(loc.toString(value[0][0], 'f', lowPrec), //(unsigned short usNdx)
loc.toString(value[0][1], 'f', lowPrec),
loc.toString(value[0][2], 'f', lowPrec),
@@ -2515,7 +2515,7 @@ QVariant PropertyRotationItem::toolTip(const App::Property* prop) const
QLocale loc;
QString data =
- QString::fromUtf8("Axis: (%1 %2 %3)\n"
+ QStringLiteral("Axis: (%1 %2 %3)\n"
"Angle: %4")
.arg(loc.toString(dir.x, 'f', decimals()),
loc.toString(dir.y, 'f', decimals()),
@@ -2534,7 +2534,7 @@ QVariant PropertyRotationItem::toString(const QVariant& prop) const
QLocale loc;
QString data =
- QString::fromUtf8("[(%1 %2 %3); %4]")
+ QStringLiteral("[(%1 %2 %3); %4]")
.arg(loc.toString(dir.x, 'f', lowPrec),
loc.toString(dir.y, 'f', lowPrec),
loc.toString(dir.z, 'f', lowPrec),
@@ -2819,7 +2819,7 @@ QVariant PropertyPlacementItem::toolTip(const App::Property* prop) const
QLocale loc;
QString data =
- QString::fromUtf8("Axis: (%1 %2 %3)\n"
+ QStringLiteral("Axis: (%1 %2 %3)\n"
"Angle: %4\n"
"Position: (%5 %6 %7)")
.arg(loc.toString(dir.x, 'f', decimals()),
@@ -2844,7 +2844,7 @@ QVariant PropertyPlacementItem::toString(const QVariant& prop) const
QLocale loc;
QString data =
- QString::fromUtf8("[(%1 %2 %3); %4; (%5 %6 %7)]")
+ QStringLiteral("[(%1 %2 %3); %4; (%5 %6 %7)]")
.arg(loc.toString(dir.x, 'f', lowPrec),
loc.toString(dir.y, 'f', lowPrec),
loc.toString(dir.z, 'f', lowPrec),
@@ -2993,7 +2993,7 @@ void PropertyEnumItem::setValue(const QVariant& value)
ss << "[";
for (const auto& it : values) {
QString text(it);
- text.replace(QString::fromUtf8("'"), QString::fromUtf8("\\'"));
+ text.replace(QStringLiteral("'"), QStringLiteral("\\'"));
std::string str = Base::Tools::escapedUnicodeFromUtf8(text.toUtf8());
str = Base::InterpreterSingleton::strToPython(str);
@@ -3231,7 +3231,7 @@ QVariant PropertyStringListItem::toString(const QVariant& prop) const
list.append(QLatin1String("..."));
}
- QString text = QString::fromUtf8("[%1]").arg(list.join(QLatin1String(",")));
+ QString text = QStringLiteral("[%1]").arg(list.join(QLatin1String(",")));
return {text};
}
@@ -3307,7 +3307,7 @@ QVariant PropertyFloatListItem::toString(const QVariant& prop) const
list = list.mid(0, size);
list.append(QLatin1String("..."));
}
- QString text = QString::fromUtf8("[%1]").arg(list.join(QLatin1String(",")));
+ QString text = QStringLiteral("[%1]").arg(list.join(QLatin1String(",")));
return {text};
}
@@ -3385,7 +3385,7 @@ QVariant PropertyIntegerListItem::toString(const QVariant& prop) const
list = list.mid(0, size);
list.append(QLatin1String("..."));
}
- QString text = QString::fromUtf8("[%1]").arg(list.join(QLatin1String(",")));
+ QString text = QStringLiteral("[%1]").arg(list.join(QLatin1String(",")));
return {text};
}
@@ -3445,7 +3445,7 @@ QVariant PropertyColorItem::toString(const QVariant& prop) const
{
auto value = prop.value();
QString color =
- QString::fromLatin1("[%1, %2, %3]").arg(value.red()).arg(value.green()).arg(value.blue());
+ QStringLiteral("[%1, %2, %3]").arg(value.red()).arg(value.green()).arg(value.blue());
return {color};
}
@@ -3464,7 +3464,7 @@ void PropertyColorItem::setValue(const QVariant& value)
}
auto col = value.value();
QString data =
- QString::fromLatin1("(%1,%2,%3)").arg(col.red()).arg(col.green()).arg(col.blue());
+ QStringLiteral("(%1,%2,%3)").arg(col.red()).arg(col.green()).arg(col.blue());
setPropertyValue(data);
}
@@ -3715,7 +3715,7 @@ QVariant PropertyMaterialItem::toString(const QVariant& prop) const
auto val = prop.value();
QColor value = val.diffuseColor;
QString color =
- QString::fromLatin1("[%1, %2, %3]").arg(value.red()).arg(value.green()).arg(value.blue());
+ QStringLiteral("[%1, %2, %3]").arg(value.red()).arg(value.green()).arg(value.blue());
return {color};
}
@@ -3729,7 +3729,7 @@ QVariant PropertyMaterialItem::toolTip(const App::Property* prop) const
auto sc = value.specularColor.asValue();
auto ec = value.emissiveColor.asValue();
- QString data = QString::fromUtf8("Diffuse color: [%1, %2, %3]\n"
+ QString data = QStringLiteral("Diffuse color: [%1, %2, %3]\n"
"Ambient color: [%4, %5, %6]\n"
"Specular color: [%7, %8, %9]\n"
"Emissive color: [%10, %11, %12]\n"
@@ -3788,7 +3788,7 @@ void PropertyMaterialItem::setValue(const QVariant& value)
float s = mat.shininess;
float t = mat.transparency;
- QString data = QString::fromLatin1("App.Material("
+ QString data = QStringLiteral("App.Material("
"DiffuseColor=(%1,%2,%3),"
"AmbientColor=(%4,%5,%6),"
"SpecularColor=(%7,%8,%9),"
@@ -4197,7 +4197,7 @@ QVariant PropertyMaterialListItem::toString(const QVariant& prop) const
auto mat = list[0].value();
QColor value = mat.diffuseColor;
QString color =
- QString::fromLatin1("[%1, %2, %3]").arg(value.red()).arg(value.green()).arg(value.blue());
+ QStringLiteral("[%1, %2, %3]").arg(value.red()).arg(value.green()).arg(value.blue());
return {color};
}
@@ -4217,7 +4217,7 @@ QVariant PropertyMaterialListItem::toolTip(const App::Property* prop) const
auto sc = value.specularColor.asValue();
auto ec = value.emissiveColor.asValue();
- QString data = QString::fromUtf8("Diffuse color: [%1, %2, %3]\n"
+ QString data = QStringLiteral("Diffuse color: [%1, %2, %3]\n"
"Ambient color: [%4, %5, %6]\n"
"Specular color: [%7, %8, %9]\n"
"Emissive color: [%10, %11, %12]\n"
@@ -4295,7 +4295,7 @@ void PropertyMaterialListItem::setValue(const QVariant& value)
float s = mat.shininess;
float t = mat.transparency;
- QString item = QString::fromLatin1("App.Material("
+ QString item = QStringLiteral("App.Material("
"DiffuseColor=(%1,%2,%3),"
"AmbientColor=(%4,%5,%6),"
"SpecularColor=(%7,%8,%9),"
@@ -4612,7 +4612,7 @@ void LinkLabel::updatePropertyLink()
auto& sobj = links.front();
link = QVariant::fromValue(sobj);
QString linkcolor = QApplication::palette().color(QPalette::Link).name();
- text = QString::fromLatin1(""
""