Base: Drop QString-std::string conversion functions from Tools

Convenience helpers function Tools::toStdString and Tools::fromStdString
were implemented for Qt4 or older to perform utf8 aware conversion as
QString::toStdString/QString::fromStdString were using toAscii/fromAscii
internally (see https://dreamswork.github.io/qt4/classQString.html).

Since Qt5 QString uses toUtf8/fromUTf8, which makes the helper functions
obsolete (see https://doc.qt.io/qt-5/qstring.html#fromStdString).
This commit is contained in:
Ladislav Michl
2024-12-02 12:34:11 +01:00
committed by Chris Hennes
parent f9d1391588
commit 0ee3c9f8e6
54 changed files with 190 additions and 255 deletions

View File

@@ -36,7 +36,6 @@
#include <App/Application.h>
#include <Base/Console.h>
#include <Base/Parameter.h>
#include <Base/Tools.h>
#include <Mod/TechDraw/App/DrawSVGTemplate.h>
#include <Mod/TechDraw/App/DrawUtil.h>
@@ -195,7 +194,7 @@ void QGISVGTemplate::createClickHandles()
"QGISVGTemplate::createClickHandles - no name for editable text at %f, %f\n", x, y);
return true;
}
std::string editableNameString = textMap[Base::Tools::toStdString(name)];
std::string editableNameString = textMap[name.toStdString()];
// default box size
double textHeight{0};
@@ -217,7 +216,7 @@ void QGISVGTemplate::createClickHandles()
QFont fontForLength(Preferences::labelFontQString());
fontForLength.setPixelSize(textHeight);
textItemForLength.setFont(fontForLength);
textItemForLength.setPlainText(Base::Tools::fromStdString(editableNameString));
textItemForLength.setPlainText(QString::fromStdString(editableNameString));
auto brect = textItemForLength.boundingRect();
auto newLength = brect.width();