From 249f11f6db4c1edfb42d908c69e1338dfab2f749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Br=C3=A6strup=20Sayoc?= Date: Sun, 9 Feb 2025 18:09:07 +0100 Subject: [PATCH] CAM: Use QStringLiteral --- src/Mod/CAM/Gui/AppPathGuiPy.cpp | 18 +++++++++--------- src/Mod/CAM/Gui/TaskDlgPathCompound.cpp | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Mod/CAM/Gui/AppPathGuiPy.cpp b/src/Mod/CAM/Gui/AppPathGuiPy.cpp index bc137ab50a..6c68254a2c 100644 --- a/src/Mod/CAM/Gui/AppPathGuiPy.cpp +++ b/src/Mod/CAM/Gui/AppPathGuiPy.cpp @@ -84,12 +84,12 @@ private: try { std::string path = App::Application::getHomePath(); path += "Mod/CAM/Path/Post/scripts/"; - QDir dir1(QString::fromUtf8(path.c_str()), QString::fromLatin1("*_pre.py")); + QDir dir1(QString::fromUtf8(path.c_str()), QStringLiteral("*_pre.py")); std::string cMacroPath = App::GetApplication() .GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro") ->GetASCII("MacroPath", App::Application::getUserMacroDir().c_str()); - QDir dir2(QString::fromUtf8(cMacroPath.c_str()), QString::fromLatin1("*_pre.py")); + QDir dir2(QString::fromUtf8(cMacroPath.c_str()), QStringLiteral("*_pre.py")); QFileInfoList list = dir1.entryInfoList(); list << dir2.entryInfoList(); std::vector scripts; @@ -116,7 +116,7 @@ private: for (int i = 0; i < list.size(); ++i) { QFileInfo fileInfo = list.at(i); if (fileInfo.baseName().toStdString() == processor) { - if (fileInfo.absoluteFilePath().contains(QString::fromLatin1("scripts"))) { + if (fileInfo.absoluteFilePath().contains(QStringLiteral("scripts"))) { pre << "from Path.Post.scripts import " << processor; } else { @@ -157,12 +157,12 @@ private: try { std::string path = App::Application::getHomePath(); path += "Mod/CAM/Path/Post/scripts/"; - QDir dir1(QString::fromUtf8(path.c_str()), QString::fromLatin1("*_pre.py")); + QDir dir1(QString::fromUtf8(path.c_str()), QStringLiteral("*_pre.py")); std::string cMacroPath = App::GetApplication() .GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro") ->GetASCII("MacroPath", App::Application::getUserMacroDir().c_str()); - QDir dir2(QString::fromUtf8(cMacroPath.c_str()), QString::fromLatin1("*_pre.py")); + QDir dir2(QString::fromUtf8(cMacroPath.c_str()), QStringLiteral("*_pre.py")); QFileInfoList list = dir1.entryInfoList(); list << dir2.entryInfoList(); std::vector scripts; @@ -200,7 +200,7 @@ private: for (int i = 0; i < list.size(); ++i) { QFileInfo fileInfo = list.at(i); if (fileInfo.baseName().toStdString() == processor) { - if (fileInfo.absoluteFilePath().contains(QString::fromLatin1("scripts"))) { + if (fileInfo.absoluteFilePath().contains(QStringLiteral("scripts"))) { pre << "from Path.Post.scripts import " << processor; } else { @@ -242,12 +242,12 @@ private: std::string path = App::Application::getHomePath(); path += "Mod/CAM/Path/Post/scripts/"; - QDir dir1(QString::fromUtf8(path.c_str()), QString::fromLatin1("*_post.py")); + QDir dir1(QString::fromUtf8(path.c_str()), QStringLiteral("*_post.py")); std::string cMacroPath = App::GetApplication() .GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro") ->GetASCII("MacroPath", App::Application::getUserMacroDir().c_str()); - QDir dir2(QString::fromUtf8(cMacroPath.c_str()), QString::fromLatin1("*_post.py")); + QDir dir2(QString::fromUtf8(cMacroPath.c_str()), QStringLiteral("*_post.py")); QFileInfoList list = dir1.entryInfoList(); list << dir2.entryInfoList(); std::vector scripts; @@ -288,7 +288,7 @@ private: for (int i = 0; i < list.size(); ++i) { QFileInfo fileInfo = list.at(i); if (fileInfo.baseName().toStdString() == processor) { - if (fileInfo.absoluteFilePath().contains(QString::fromLatin1("scripts"))) { + if (fileInfo.absoluteFilePath().contains(QStringLiteral("scripts"))) { pre << "from Path.Post.scripts import " << processor; } else { diff --git a/src/Mod/CAM/Gui/TaskDlgPathCompound.cpp b/src/Mod/CAM/Gui/TaskDlgPathCompound.cpp index 862a63f113..247999ac71 100644 --- a/src/Mod/CAM/Gui/TaskDlgPathCompound.cpp +++ b/src/Mod/CAM/Gui/TaskDlgPathCompound.cpp @@ -62,9 +62,9 @@ TaskWidgetPathCompound::TaskWidgetPathCompound(ViewProviderPathCompound* Compoun for (std::vector::const_iterator it = Paths.begin(); it != Paths.end(); ++it) { QString name = QString::fromLatin1((*it)->getNameInDocument()); - name += QString::fromLatin1(" ("); + name += QStringLiteral(" ("); name += QString::fromUtf8((*it)->Label.getValue()); - name += QString::fromLatin1(")"); + name += QStringLiteral(")"); ui->PathsList->addItem(name); } } @@ -81,7 +81,7 @@ std::vector TaskWidgetPathCompound::getList() const QListWidgetItem* item = ui->PathsList->item(i); QString name = item->text(); QStringList result; - result = name.split(QRegularExpression(QString::fromLatin1("\\s+"))); + result = name.split(QRegularExpression(QStringLiteral("\\s+"))); std::cout << result[0].toStdString() << std::endl; names.push_back(result[0].toStdString()); }