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:
committed by
Chris Hennes
parent
f9d1391588
commit
0ee3c9f8e6
@@ -27,7 +27,6 @@
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/UnitsApi.h>
|
||||
|
||||
#include "DimensionFormatter.h"
|
||||
@@ -90,7 +89,7 @@ std::string DimensionFormatter::formatValue(const qreal value,
|
||||
QString formatSpecifier = qsl[2]; //FormatSpec specifier
|
||||
|
||||
QString qMultiValueStr;
|
||||
QString qBasicUnit = Base::Tools::fromStdString(Base::UnitsApi::getBasicLengthUnit());
|
||||
QString qBasicUnit = QString::fromStdString(Base::UnitsApi::getBasicLengthUnit());
|
||||
|
||||
QString formattedValue;
|
||||
if (isMultiValueSchema() && partial == 0) {
|
||||
@@ -102,7 +101,7 @@ std::string DimensionFormatter::formatValue(const qreal value,
|
||||
if (formatSpecifier.isEmpty()) {
|
||||
Base::Console().Warning("Warning - no numeric format in Format Spec %s - %s\n",
|
||||
qPrintable(qFormatSpec), m_dimension->getNameInDocument());
|
||||
return Base::Tools::toStdString(qFormatSpec);
|
||||
return qFormatSpec.toStdString();
|
||||
}
|
||||
|
||||
// for older TD drawings the formatSpecifier "%g" was used, but the number of decimals was
|
||||
@@ -158,45 +157,44 @@ std::string DimensionFormatter::formatValue(const qreal value,
|
||||
//formattedValue is now in formatSpec format with local decimal separator
|
||||
std::string formattedValueString = formattedValue.toStdString();
|
||||
if (partial == 0) { //prefix + unit subsystem string + suffix
|
||||
return Base::Tools::toStdString(formatPrefix) +
|
||||
Base::Tools::toStdString(qUserString) +
|
||||
Base::Tools::toStdString(formatSuffix);
|
||||
return formatPrefix.toStdString() +
|
||||
qUserString.toStdString() +
|
||||
formatSuffix.toStdString();
|
||||
}
|
||||
else if (partial == 1) { // prefix number[unit] suffix
|
||||
if (angularMeasure) {
|
||||
//always insert unit after value
|
||||
return Base::Tools::toStdString(formatPrefix) +
|
||||
formattedValueString + "°" +
|
||||
Base::Tools::toStdString(formatSuffix);
|
||||
return formatPrefix.toStdString() + formattedValueString + "°" +
|
||||
formatSuffix.toStdString();
|
||||
}
|
||||
else if (m_dimension->showUnits() || areaMeasure){
|
||||
if (isDim && m_dimension->haveTolerance()) {
|
||||
//unit will be included in tolerance so don't repeat it here
|
||||
return Base::Tools::toStdString(formatPrefix) +
|
||||
return formatPrefix.toStdString() +
|
||||
formattedValueString +
|
||||
Base::Tools::toStdString(formatSuffix);
|
||||
formatSuffix.toStdString();
|
||||
}
|
||||
else {
|
||||
//no tolerance, so we need to include unit
|
||||
return Base::Tools::toStdString(formatPrefix) +
|
||||
return formatPrefix.toStdString() +
|
||||
formattedValueString + " " +
|
||||
Base::Tools::toStdString(qBasicUnit) +
|
||||
Base::Tools::toStdString(formatSuffix);
|
||||
qBasicUnit.toStdString() +
|
||||
formatSuffix.toStdString();
|
||||
}
|
||||
}
|
||||
else {
|
||||
//showUnits is false
|
||||
return Base::Tools::toStdString(formatPrefix) +
|
||||
return formatPrefix.toStdString() +
|
||||
formattedValueString +
|
||||
Base::Tools::toStdString(formatSuffix);
|
||||
formatSuffix.toStdString();
|
||||
}
|
||||
}
|
||||
else if (partial == 2) { // just the unit
|
||||
if (angularMeasure) {
|
||||
return Base::Tools::toStdString(qBasicUnit);
|
||||
return qBasicUnit.toStdString();
|
||||
}
|
||||
else if (m_dimension->showUnits() || areaMeasure) {
|
||||
return Base::Tools::toStdString(qBasicUnit);
|
||||
return qBasicUnit.toStdString();
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
@@ -318,14 +316,14 @@ QString DimensionFormatter::formatValueToSpec(const double value, const QString&
|
||||
QString fs = formatSpecifier;
|
||||
fs.replace(QRegularExpression(QStringLiteral("%(.*)w")), QStringLiteral("%\\1f"));
|
||||
fs.replace(QRegularExpression(QStringLiteral("%(.*)W")), QStringLiteral("%\\1F"));
|
||||
formattedValue = QString::asprintf(Base::Tools::toStdString(fs).c_str(), value);
|
||||
formattedValue = QString::asprintf(fs.toStdString().c_str(), value);
|
||||
// First, try to cut trailing zeros, if AFTER decimal dot there are nonzero numbers
|
||||
// Second, try to cut also decimal dot and zeros, if there are just zeros after it
|
||||
formattedValue.replace(QRegularExpression(QStringLiteral("([0-9][0-9]*\\.[0-9]*[1-9])00*$")), QStringLiteral("\\1"));
|
||||
formattedValue.replace(QRegularExpression(QStringLiteral("([0-9][0-9]*)\\.0*$")), QStringLiteral("\\1"));
|
||||
} else {
|
||||
if (isNumericFormat(formatSpecifier)) {
|
||||
formattedValue = QString::asprintf(Base::Tools::toStdString(formatSpecifier).c_str(), value);
|
||||
formattedValue = QString::asprintf(formatSpecifier.toStdString().c_str(), value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,8 +372,8 @@ std::string DimensionFormatter::getDefaultFormatSpec(bool isToleranceFormat) con
|
||||
QString formatSpec;
|
||||
QString qPrefix;
|
||||
if (prefFormat.empty()) {
|
||||
QString format1 = Base::Tools::fromStdString("%.");
|
||||
QString format2 = Base::Tools::fromStdString("f");
|
||||
QString format1 = QString::fromStdString("%.");
|
||||
QString format2 = QString::fromStdString("f");
|
||||
int precision;
|
||||
if (m_dimension->useDecimals()) {
|
||||
precision = Base::UnitsApi::getDecimals();
|
||||
@@ -403,7 +401,7 @@ std::string DimensionFormatter::getDefaultFormatSpec(bool isToleranceFormat) con
|
||||
formatSpec.replace(QString::fromUtf8("%"), QString::fromUtf8("%+"));
|
||||
}
|
||||
|
||||
return Base::Tools::toStdString(formatSpec);
|
||||
return formatSpec.toStdString();
|
||||
}
|
||||
|
||||
//true if value is too small to display using formatSpec
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include <Base/Console.h>
|
||||
#include <Base/FileInfo.h>
|
||||
#include <Base/Quantity.h>
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include "DrawPage.h"
|
||||
#include "DrawSVGTemplate.h"
|
||||
@@ -205,7 +204,7 @@ bool DrawSVGTemplate::getTemplateDocument(std::string sourceFile, QDomDocument&
|
||||
if (sourceFile.empty()) {
|
||||
return false;
|
||||
}
|
||||
QFile templateFile(Base::Tools::fromStdString(sourceFile));
|
||||
QFile templateFile(QString::fromStdString(sourceFile));
|
||||
if (!templateFile.open(QIODevice::ReadOnly)) {
|
||||
Base::Console().Error("DrawSVGTemplate::processTemplate can't read embedded template %s!\n", PageResult.getValue());
|
||||
return false;
|
||||
|
||||
@@ -61,7 +61,6 @@
|
||||
#include <Base/FileInfo.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Stream.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/UnitsApi.h>
|
||||
#include <Base/Vector3D.h>
|
||||
|
||||
@@ -1861,8 +1860,7 @@ std::string DrawUtil::translateArbitrary(std::string context, std::string baseNa
|
||||
suffix = uniqueName.substr(baseName.length(), uniqueName.length() - baseName.length());
|
||||
}
|
||||
QString qTranslated = qApp->translate(context.c_str(), baseName.c_str());
|
||||
std::string ssTranslated = Base::Tools::toStdString(qTranslated);
|
||||
return ssTranslated + suffix;
|
||||
return qTranslated.toStdString() + suffix;
|
||||
}
|
||||
|
||||
// true if owner->element is a cosmetic vertex
|
||||
|
||||
@@ -273,7 +273,7 @@ std::string DrawViewSpreadsheet::getSheetImage()
|
||||
if (prop->isDerivedFrom(App::PropertyQuantity::getClassTypeId())) {
|
||||
auto contentAsQuantity = static_cast<App::PropertyQuantity*>(prop)->getQuantityValue();
|
||||
auto ustring = contentAsQuantity.getUserString();
|
||||
field << Base::Tools::toStdString(ustring);
|
||||
field << ustring.toStdString();
|
||||
} else if (prop->isDerivedFrom(App::PropertyFloat::getClassTypeId()) ||
|
||||
prop->isDerivedFrom(App::PropertyInteger::getClassTypeId())) {
|
||||
std::string temp = cell->getFormattedQuantity();
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Interpreter.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Language/Translator.h>
|
||||
#include <Gui/WidgetFactory.h>
|
||||
@@ -90,7 +89,7 @@ void loadTechDrawResource()
|
||||
{"osifont-lgpl3fe.ttf", "osifont-italic.ttf", "Y14.5-2018.ttf", "Y14.5-FreeCAD.ttf"});
|
||||
|
||||
for (auto& font : fontsAll) {
|
||||
QString fontFile = Base::Tools::fromStdString(fontDir + font);
|
||||
QString fontFile = QString::fromStdString(fontDir + font);
|
||||
int rc = QFontDatabase::addApplicationFont(fontFile);
|
||||
if (rc < 0) {
|
||||
Base::Console().Warning(
|
||||
|
||||
@@ -138,7 +138,7 @@ void CmdTechDrawPageDefault::activated(int iMsg)
|
||||
svgTemplate->translateLabel("DrawSVGTemplate", "Template", svgTemplate->getNameInDocument());
|
||||
|
||||
page->Template.setValue(svgTemplate);
|
||||
auto filespec = DU::cleanFilespecBackslash(Base::Tools::toStdString(templateFileName));
|
||||
auto filespec = DU::cleanFilespecBackslash(templateFileName.toStdString());
|
||||
svgTemplate->Template.setValue(filespec);
|
||||
|
||||
updateActive();
|
||||
@@ -209,7 +209,7 @@ void CmdTechDrawPageTemplate::activated(int iMsg)
|
||||
svgTemplate->translateLabel("DrawSVGTemplate", "Template", svgTemplate->getNameInDocument());
|
||||
|
||||
page->Template.setValue(svgTemplate);
|
||||
auto filespec = DU::cleanFilespecBackslash(Base::Tools::toStdString(templateFileName));
|
||||
auto filespec = DU::cleanFilespecBackslash(templateFileName.toStdString());
|
||||
svgTemplate->Template.setValue(filespec);
|
||||
|
||||
updateActive();
|
||||
@@ -453,7 +453,7 @@ void CmdTechDrawView::activated(int iMsg)
|
||||
|| filename.endsWith(QString::fromLatin1(".svgz"), Qt::CaseInsensitive)) {
|
||||
std::string FeatName = getUniqueObjectName("Symbol");
|
||||
filename = Base::Tools::escapeEncodeFilename(filename);
|
||||
auto filespec = DU::cleanFilespecBackslash(Base::Tools::toStdString(filename));
|
||||
auto filespec = DU::cleanFilespecBackslash(filename.toStdString());
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Create Symbol"));
|
||||
doCommand(Doc, "f = open(\"%s\", 'r')", filespec.c_str());
|
||||
doCommand(Doc, "svg = f.read()");
|
||||
@@ -469,7 +469,7 @@ void CmdTechDrawView::activated(int iMsg)
|
||||
else {
|
||||
std::string FeatName = getUniqueObjectName("Image");
|
||||
filename = Base::Tools::escapeEncodeFilename(filename);
|
||||
auto filespec = DU::cleanFilespecBackslash(Base::Tools::toStdString(filename));
|
||||
auto filespec = DU::cleanFilespecBackslash(filename.toStdString());
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Create Image"));
|
||||
doCommand(Doc, "App.activeDocument().addObject('TechDraw::DrawViewImage', '%s')", FeatName.c_str());
|
||||
doCommand(Doc, "App.activeDocument().%s.translateLabel('DrawViewImage', 'Image', '%s')",
|
||||
@@ -1548,7 +1548,7 @@ void CmdTechDrawSymbol::activated(int iMsg)
|
||||
if (!filename.isEmpty()) {
|
||||
std::string FeatName = getUniqueObjectName("Symbol");
|
||||
filename = Base::Tools::escapeEncodeFilename(filename);
|
||||
auto filespec = DU::cleanFilespecBackslash(Base::Tools::toStdString(filename));
|
||||
auto filespec = DU::cleanFilespecBackslash(filename.toStdString());
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Create Symbol"));
|
||||
doCommand(Doc, "f = open(\"%s\", 'r')", (const char*)filespec.c_str());
|
||||
doCommand(Doc, "svg = f.read()");
|
||||
@@ -1863,7 +1863,7 @@ void CmdTechDrawExportPageDXF::activated(int iMsg)
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Save page to DXF"));
|
||||
doCommand(Doc, "import TechDraw");
|
||||
fileName = Base::Tools::escapeEncodeFilename(fileName);
|
||||
auto filespec = DU::cleanFilespecBackslash(Base::Tools::toStdString(fileName));
|
||||
auto filespec = DU::cleanFilespecBackslash(fileName.toStdString());
|
||||
doCommand(Doc, "TechDraw.writeDXFPage(App.activeDocument().%s, u\"%s\")", PageName.c_str(),
|
||||
filespec.c_str());
|
||||
commitCommand();
|
||||
|
||||
@@ -267,7 +267,7 @@ void CmdTechDrawImage::activated(int iMsg)
|
||||
|
||||
std::string FeatName = getUniqueObjectName("Image");
|
||||
fileName = Base::Tools::escapeEncodeFilename(fileName);
|
||||
auto filespec = DU::cleanFilespecBackslash(Base::Tools::toStdString(fileName));
|
||||
auto filespec = DU::cleanFilespecBackslash(fileName.toStdString());
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Create Image"));
|
||||
doCommand(Doc, "App.activeDocument().addObject('TechDraw::DrawViewImage', '%s')", FeatName.c_str());
|
||||
doCommand(Doc, "App.activeDocument().%s.translateLabel('DrawViewImage', 'Image', '%s')",
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/Type.h>
|
||||
#include <Gui/Action.h>
|
||||
#include <Gui/Application.h>
|
||||
@@ -1846,7 +1845,7 @@ void CmdTechDrawExtensionAreaAnnotation::activated(int iMsg)
|
||||
qUserString.chop(2);
|
||||
qUserString.append(QString::fromUtf8("²"));
|
||||
}
|
||||
std::string sUserString = Base::Tools::toStdString(qUserString);
|
||||
std::string sUserString = qUserString.toStdString();
|
||||
|
||||
// set the attributes in the data tab's fields
|
||||
// balloon->SourceView.setValue(objFeat);
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h> // for FC_LOG_LEVEL_INIT
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include "DlgPageChooser.h"
|
||||
#include "ui_DlgPageChooser.h"
|
||||
@@ -72,8 +71,8 @@ void DlgPageChooser::fillList(std::vector<std::string> labels, std::vector<std::
|
||||
int labelCount = labels.size();
|
||||
int i = 0;
|
||||
for (; i < labelCount; i++) {
|
||||
qLabel = Base::Tools::fromStdString(labels[i]);
|
||||
qName = Base::Tools::fromStdString(names[i]);
|
||||
qLabel = QString::fromStdString(labels[i]);
|
||||
qName = QString::fromStdString(names[i]);
|
||||
qText = QString::fromUtf8("%1 (%2)").arg(qLabel, qName);
|
||||
item = new QListWidgetItem(qText, ui->lwPages);
|
||||
item->setData(Qt::UserRole, qName);
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include <Base/Tools.h>
|
||||
#include <App/Application.h>
|
||||
|
||||
#include "DlgPrefsTechDrawDimensionsImp.h"
|
||||
@@ -150,7 +149,7 @@ void DlgPrefsTechDrawDimensionsImp::loadSettings()
|
||||
DrawGuiUtil::loadArrowBox(ui->pcbArrow);
|
||||
ui->pcbArrow->setCurrentIndex(prefArrowStyle());
|
||||
|
||||
ui->leFormatSpec->setText(Base::Tools::fromStdString(Preferences::formatSpec()));
|
||||
ui->leFormatSpec->setText(QString::fromStdString(Preferences::formatSpec()));
|
||||
ui->leFormatSpec->onRestore();
|
||||
|
||||
ui->pdsbGapISO->onRestore();
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
# include <QListWidgetItem>
|
||||
#endif
|
||||
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include "DlgStringListEditor.h"
|
||||
#include "ui_DlgStringListEditor.h"
|
||||
|
||||
@@ -70,7 +68,7 @@ void DlgStringListEditor::fillList(std::vector<std::string> texts)
|
||||
int textCount = texts.size();
|
||||
int i = 0;
|
||||
for (; i < textCount; i++) {
|
||||
qText = Base::Tools::fromStdString(texts[i]);
|
||||
qText = QString::fromStdString(texts[i]);
|
||||
QListWidgetItem* item = new QListWidgetItem(qText);
|
||||
item->setFlags(item->flags() | Qt::ItemIsEditable);
|
||||
ui->lwTexts->addItem(item);
|
||||
@@ -125,7 +123,7 @@ std::vector<std::string> DlgStringListEditor::getTexts() const
|
||||
|
||||
for (int iRow = 0; iRow < ui->lwTexts->count(); iRow++) {
|
||||
QString itemText = ui->lwTexts->item(iRow)->text();
|
||||
outTexts.push_back(Base::Tools::toStdString(itemText));
|
||||
outTexts.push_back(itemText.toStdString());
|
||||
}
|
||||
if (outTexts.back().empty()) {
|
||||
outTexts.pop_back();
|
||||
|
||||
@@ -164,7 +164,7 @@ void DrawGuiUtil::loadLineStandardsChoices(QComboBox* combo)
|
||||
combo->clear();
|
||||
std::vector<std::string> choices = LineGenerator::getAvailableLineStandards();
|
||||
for (auto& entry : choices) {
|
||||
QString qentry = Base::Tools::fromStdString(entry);
|
||||
QString qentry = QString::fromStdString(entry);
|
||||
combo->addItem(qentry);
|
||||
}
|
||||
}
|
||||
@@ -201,7 +201,7 @@ void DrawGuiUtil::loadLineGroupChoices(QComboBox* combo)
|
||||
std::stringstream ss(lgRecord);
|
||||
std::vector<QString> lgNames;
|
||||
while (std::getline(ss, lgRecord, ',')) {
|
||||
lgNames.push_back(Base::Tools::fromStdString(lgRecord));
|
||||
lgNames.push_back(QString::fromStdString(lgRecord));
|
||||
}
|
||||
// fill the combobox with the found names
|
||||
for (auto& name : lgNames) {
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Stream.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Document.h>
|
||||
@@ -136,7 +135,7 @@ void MDIViewPage::setScene(QGSPage* scene, QGVPage* viewWidget)
|
||||
void MDIViewPage::setDocumentObject(const std::string& name)
|
||||
{
|
||||
m_objectName = name;
|
||||
setObjectName(Base::Tools::fromStdString(name));
|
||||
setObjectName(QString::fromStdString(name));
|
||||
}
|
||||
|
||||
void MDIViewPage::setDocumentName(const std::string& name) { m_documentName = name; }
|
||||
@@ -480,7 +479,7 @@ void MDIViewPage::saveSVG()
|
||||
return;
|
||||
}
|
||||
static_cast<void>(blockSelection(true));// avoid to be notified by itself
|
||||
saveSVG(Base::Tools::toStdString(fn));
|
||||
saveSVG(fn.toStdString());
|
||||
static_cast<void>(blockSelection(false));
|
||||
}
|
||||
|
||||
|
||||
@@ -348,7 +348,7 @@ void PagePrinter::printPdf(ViewProviderPage* vpPage, const std::string& file)
|
||||
filespec = DU::cleanFilespecBackslash(filespec);
|
||||
|
||||
// set up the pdfwriter
|
||||
QString outputFile = Base::Tools::fromStdString(filespec);
|
||||
QString outputFile = QString::fromStdString(filespec);
|
||||
QPdfWriter pdfWriter(outputFile);
|
||||
QPageLayout pageLayout = pdfWriter.pageLayout();
|
||||
auto marginsdb = pageLayout.margins(QPageLayout::Millimeter);
|
||||
@@ -396,7 +396,7 @@ void PagePrinter::saveSVG(ViewProviderPage* vpPage, const std::string& file)
|
||||
}
|
||||
auto filespec = Base::Tools::escapeEncodeFilename(file);
|
||||
filespec = DU::cleanFilespecBackslash(file);
|
||||
QString filename = Base::Tools::fromStdString(filespec);
|
||||
QString filename = QString::fromStdString(filespec);
|
||||
|
||||
auto ourScene = vpPage->getQGSPage();
|
||||
ourScene->setExportingSvg(true);
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
# include <QStyleOptionGraphicsItem>
|
||||
#endif
|
||||
|
||||
#include <Base/Tools.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
|
||||
#include "QGIHighlight.h"
|
||||
@@ -100,7 +99,7 @@ void QGIHighlight::makeHighlight()
|
||||
void QGIHighlight::makeReference()
|
||||
{
|
||||
prepareGeometryChange();
|
||||
int fontSize = QGIView::exactFontSize(Base::Tools::toStdString(m_refFont.family()),
|
||||
int fontSize = QGIView::exactFontSize(m_refFont.family().toStdString(),
|
||||
m_refSize);
|
||||
m_refFont .setPixelSize(fontSize);
|
||||
m_reference->setFont(m_refFont);
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <App/Application.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include <Mod/TechDraw/App/Preferences.h>
|
||||
|
||||
@@ -208,7 +207,7 @@ void QGISectionLine::makeSymbols()
|
||||
void QGISectionLine::makeSymbolsTrad()
|
||||
{
|
||||
prepareGeometryChange();
|
||||
int fontSize = QGIView::exactFontSize(Base::Tools::toStdString(m_symFont.family()), m_symSize);
|
||||
int fontSize = QGIView::exactFontSize(m_symFont.family().toStdString(), m_symSize);
|
||||
m_symFont.setPixelSize(fontSize);
|
||||
m_symbol1->setFont(m_symFont);
|
||||
m_symbol1->setPlainText(QString::fromUtf8(m_symbol));
|
||||
@@ -238,7 +237,7 @@ void QGISectionLine::makeSymbolsTrad()
|
||||
void QGISectionLine::makeSymbolsISO()
|
||||
{
|
||||
prepareGeometryChange();
|
||||
int fontSize = QGIView::exactFontSize(Base::Tools::toStdString(m_symFont.family()), m_symSize);
|
||||
int fontSize = QGIView::exactFontSize(m_symFont.family().toStdString(), m_symSize);
|
||||
m_symFont.setPixelSize(fontSize);
|
||||
m_symbol1->setFont(m_symFont);
|
||||
m_symbol1->setPlainText(QString::fromUtf8(m_symbol));
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <Base/FileInfo.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Stream.h>
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawTileWeld.h>
|
||||
|
||||
@@ -262,7 +261,7 @@ void QGITile::setFont(QFont f, double fSizePx)
|
||||
|
||||
void QGITile::setFont(std::string fName, double fSizePx)
|
||||
{
|
||||
QString qFName = Base::Tools::fromStdString(fName);
|
||||
QString qFName = QString::fromStdString(fName);
|
||||
QFont f(qFName);
|
||||
setFont(f, fSizePx);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawLeaderLine.h>
|
||||
#include <Mod/TechDraw/App/DrawTile.h>
|
||||
@@ -254,7 +253,7 @@ void QGIWeldSymbol::drawTailText()
|
||||
if (!vp) {
|
||||
return;
|
||||
}
|
||||
QString qFontName = Base::Tools::fromStdString(vp->Font.getValue());
|
||||
QString qFontName = QString::fromStdString(vp->Font.getValue());
|
||||
int fontSize = QGIView::exactFontSize(vp->Font.getValue(),
|
||||
vp->FontSize.getValue());
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
#include <App/Document.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
@@ -203,7 +202,7 @@ TechDraw::DrawViewImage* TaskActiveView::createActiveView()
|
||||
QImage::Format_RGB32); //arbitrary initial image size.
|
||||
image.fill(QColor(Qt::transparent));
|
||||
Grabber3d::quickView(view3d, bg, image);
|
||||
bool success = image.save(Base::Tools::fromStdString(tempName));
|
||||
bool success = image.save(QString::fromStdString(tempName));
|
||||
|
||||
if (!success) {
|
||||
Base::Console().Error("ActiveView could not save file: %s\n", fileSpec.c_str());
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/UnitsApi.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
@@ -170,9 +169,9 @@ void TaskCenterLine::setUiPrimary()
|
||||
|
||||
if (m_partFeat) {
|
||||
std::string baseName = m_partFeat->getNameInDocument();
|
||||
ui->leBaseView->setText(Base::Tools::fromStdString(baseName));
|
||||
ui->leBaseView->setText(QString::fromStdString(baseName));
|
||||
for (auto& s: m_subNames) {
|
||||
QString listItem = Base::Tools::fromStdString(s);
|
||||
QString listItem = QString::fromStdString(s);
|
||||
ui->lstSubList->addItem(listItem);
|
||||
}
|
||||
}
|
||||
@@ -212,8 +211,8 @@ void TaskCenterLine::setUiEdit()
|
||||
setWindowTitle(QObject::tr("Edit Center Line"));
|
||||
if (m_partFeat) {
|
||||
std::string baseName = m_partFeat->getNameInDocument();
|
||||
ui->leBaseView->setText(Base::Tools::fromStdString(baseName));
|
||||
QString listItem = Base::Tools::fromStdString(m_edgeName);
|
||||
ui->leBaseView->setText(QString::fromStdString(baseName));
|
||||
QString listItem = QString::fromStdString(m_edgeName);
|
||||
ui->lstSubList->addItem(listItem);
|
||||
}
|
||||
ui->cpLineColor->setColor(m_cl->m_format.getColor().asValue<QColor>());
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <App/Document.h>
|
||||
#include <App/Link.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Control.h>
|
||||
@@ -149,13 +148,13 @@ void TaskComplexSection::setUiPrimary()
|
||||
setUiCommon();
|
||||
|
||||
if (m_baseView) {
|
||||
ui->leBaseView->setText(Base::Tools::fromStdString(m_baseView->getNameInDocument()));
|
||||
ui->leBaseView->setText(QString::fromStdString(m_baseView->getNameInDocument()));
|
||||
//if there is a baseView, we don't know the sectionNormal yet and have to wait until
|
||||
//one is picked in the dialog
|
||||
Base::Vector3d defaultNormal(-1.0, 0.0, 0.0);
|
||||
m_saveNormal = defaultNormal;
|
||||
m_saveXDir = Base::Vector3d(0.0, 1.0, 0.0);
|
||||
ui->leBaseView->setText(Base::Tools::fromStdString(m_baseView->getNameInDocument()));
|
||||
ui->leBaseView->setText(QString::fromStdString(m_baseView->getNameInDocument()));
|
||||
m_compass->setDialAngle(0.0);
|
||||
m_viewDirectionWidget->setValueNoNotify(Base::Vector3d(1.0, 0.0, 0.0));
|
||||
}
|
||||
@@ -179,10 +178,10 @@ void TaskComplexSection::setUiEdit()
|
||||
setWindowTitle(QObject::tr("Edit Complex Section"));
|
||||
|
||||
if (m_baseView) {
|
||||
ui->leBaseView->setText(Base::Tools::fromStdString(m_baseView->getNameInDocument()));
|
||||
ui->leBaseView->setText(QString::fromStdString(m_baseView->getNameInDocument()));
|
||||
}
|
||||
ui->cmbStrategy->setCurrentIndex(m_section->ProjectionStrategy.getValue());
|
||||
ui->leSymbol->setText(Base::Tools::fromStdString(m_section->SectionSymbol.getValue()));
|
||||
ui->leSymbol->setText(QString::fromStdString(m_section->SectionSymbol.getValue()));
|
||||
ui->sbScale->setValue(m_section->Scale.getValue());
|
||||
ui->cmbScaleType->setCurrentIndex(m_section->getScaleType());
|
||||
|
||||
@@ -190,7 +189,7 @@ void TaskComplexSection::setUiEdit()
|
||||
|
||||
Base::Vector3d sectionNormalVec = m_section->SectionNormal.getValue();
|
||||
if (m_baseView) {
|
||||
ui->leBaseView->setText(Base::Tools::fromStdString(m_baseView->getNameInDocument()));
|
||||
ui->leBaseView->setText(QString::fromStdString(m_baseView->getNameInDocument()));
|
||||
Base::Vector3d projectedViewDirection = m_baseView->projectPoint(sectionNormalVec, false);
|
||||
double viewAngle = atan2(-projectedViewDirection.y, -projectedViewDirection.x);
|
||||
m_compass->setDialAngle(viewAngle * 180.0 / M_PI);
|
||||
@@ -205,9 +204,9 @@ void TaskComplexSection::setUiEdit()
|
||||
void TaskComplexSection::setUiCommon()
|
||||
{
|
||||
ui->leSectionObjects->setText(sourcesToString());
|
||||
ui->leProfileObject->setText(Base::Tools::fromStdString(m_profileObject->getNameInDocument())
|
||||
ui->leProfileObject->setText(QString::fromStdString(m_profileObject->getNameInDocument())
|
||||
+ QString::fromUtf8(" / ")
|
||||
+ Base::Tools::fromStdString(m_profileObject->Label.getValue()));
|
||||
+ QString::fromStdString(m_profileObject->Label.getValue()));
|
||||
|
||||
m_compass = new CompassWidget(this);
|
||||
auto layout = ui->compassLayout;
|
||||
@@ -383,9 +382,9 @@ void TaskComplexSection::onProfileObjectsUseSelectionClicked()
|
||||
if (!selection.empty()) {
|
||||
m_profileObject = selection.front().getObject();
|
||||
ui->leProfileObject->setText(
|
||||
Base::Tools::fromStdString(m_profileObject->getNameInDocument())
|
||||
QString::fromStdString(m_profileObject->getNameInDocument())
|
||||
+ QString::fromUtf8(" / ")
|
||||
+ Base::Tools::fromStdString(m_profileObject->Label.getValue()));
|
||||
+ QString::fromStdString(m_profileObject->Label.getValue()));
|
||||
}
|
||||
}
|
||||
void TaskComplexSection::scaleTypeChanged(int index)
|
||||
@@ -452,25 +451,25 @@ QString TaskComplexSection::sourcesToString()
|
||||
QString currentSeparator;
|
||||
if (m_baseView) {
|
||||
for (auto& obj : m_baseView->Source.getValues()) {
|
||||
result += currentSeparator + Base::Tools::fromStdString(obj->getNameInDocument())
|
||||
+ QString::fromUtf8(" / ") + Base::Tools::fromStdString(obj->Label.getValue());
|
||||
result += currentSeparator + QString::fromStdString(obj->getNameInDocument())
|
||||
+ QString::fromUtf8(" / ") + QString::fromStdString(obj->Label.getValue());
|
||||
currentSeparator = separator;
|
||||
}
|
||||
currentSeparator = QString();
|
||||
for (auto& obj : m_baseView->XSource.getValues()) {
|
||||
result += currentSeparator + Base::Tools::fromStdString(obj->getNameInDocument())
|
||||
+ QString::fromUtf8(" / ") + Base::Tools::fromStdString(obj->Label.getValue());
|
||||
result += currentSeparator + QString::fromStdString(obj->getNameInDocument())
|
||||
+ QString::fromUtf8(" / ") + QString::fromStdString(obj->Label.getValue());
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (auto& obj : m_shapes) {
|
||||
result += currentSeparator + Base::Tools::fromStdString(obj->getNameInDocument())
|
||||
+ QString::fromUtf8(" / ") + Base::Tools::fromStdString(obj->Label.getValue());
|
||||
result += currentSeparator + QString::fromStdString(obj->getNameInDocument())
|
||||
+ QString::fromUtf8(" / ") + QString::fromStdString(obj->Label.getValue());
|
||||
}
|
||||
currentSeparator = QString();
|
||||
for (auto& obj : m_xShapes) {
|
||||
result += currentSeparator + Base::Tools::fromStdString(obj->getNameInDocument())
|
||||
+ QString::fromUtf8(" / ") + Base::Tools::fromStdString(obj->Label.getValue());
|
||||
result += currentSeparator + QString::fromStdString(obj->getNameInDocument())
|
||||
+ QString::fromUtf8(" / ") + QString::fromStdString(obj->Label.getValue());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -568,7 +567,7 @@ void TaskComplexSection::createComplexSection()
|
||||
// we pluck the generated suffix from the object name and append it to "Section" to generate
|
||||
// unique Labels
|
||||
QString qTemp = ui->leSymbol->text();
|
||||
std::string temp = Base::Tools::toStdString(qTemp);
|
||||
std::string temp = qTemp.toStdString();
|
||||
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.SectionSymbol = '%s'",
|
||||
m_sectionName.c_str(), temp.c_str());
|
||||
|
||||
@@ -653,7 +652,7 @@ void TaskComplexSection::updateComplexSection()
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Edit Section View"));
|
||||
if (m_section) {
|
||||
QString qTemp = ui->leSymbol->text();
|
||||
std::string temp = Base::Tools::toStdString(qTemp);
|
||||
std::string temp = qTemp.toStdString();
|
||||
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.SectionSymbol = '%s'",
|
||||
m_sectionName.c_str(), temp.c_str());
|
||||
|
||||
@@ -704,14 +703,14 @@ std::string TaskComplexSection::makeSectionLabel(QString symbol)
|
||||
const std::string objectName{QT_TR_NOOP("ComplexSection")};
|
||||
std::string uniqueSuffix{m_sectionName.substr(objectName.length(), std::string::npos)};
|
||||
std::string uniqueLabel = "Section" + uniqueSuffix;
|
||||
std::string temp = Base::Tools::toStdString(symbol);
|
||||
std::string temp = symbol.toStdString();
|
||||
return ( uniqueLabel + " " + temp + " - " + temp );
|
||||
}
|
||||
|
||||
void TaskComplexSection::failNoObject(void)
|
||||
{
|
||||
QString qsectionName = Base::Tools::fromStdString(m_sectionName);
|
||||
QString qbaseName = Base::Tools::fromStdString(m_saveBaseName);
|
||||
QString qsectionName = QString::fromStdString(m_sectionName);
|
||||
QString qbaseName = QString::fromStdString(m_saveBaseName);
|
||||
QString msg = tr("Can not continue. Object * %1 or %2 not found.").arg(qsectionName, qbaseName);
|
||||
QMessageBox::critical(Gui::getMainWindow(), QObject::tr("Operation Failed"), msg);
|
||||
Gui::Control().closeDialog();
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#endif // #ifndef _PreComp_
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/UnitsApi.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
@@ -110,7 +109,7 @@ void TaskCosVertex::setUiPrimary()
|
||||
|
||||
if (m_baseFeat) {
|
||||
std::string baseName = m_baseFeat->getNameInDocument();
|
||||
ui->leBaseView->setText(Base::Tools::fromStdString(baseName));
|
||||
ui->leBaseView->setText(QString::fromStdString(baseName));
|
||||
}
|
||||
ui->pbTracker->setText(tr("Point Picker"));
|
||||
ui->pbTracker->setEnabled(true);
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#endif
|
||||
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Mod/TechDraw/App/DrawViewBalloon.h>
|
||||
@@ -84,13 +83,13 @@ void TaskCustomizeFormat::setUiEdit()
|
||||
isDimension = true;
|
||||
std::string dimText = dim->FormatSpec.getStrValue();
|
||||
dimRawValue = dim->getDimValue();
|
||||
ui->leFormat->setText(Base::Tools::fromStdString(dimText));
|
||||
ui->leFormat->setText(QString::fromStdString(dimText));
|
||||
}
|
||||
else if (auto balloon = dynamic_cast<TechDraw::DrawViewBalloon*>(selectedObject))
|
||||
{
|
||||
isDimension = false;
|
||||
std::string balloonText = balloon->Text.getStrValue();
|
||||
ui->leFormat->setText(Base::Tools::fromStdString(balloonText));
|
||||
ui->leFormat->setText(QString::fromStdString(balloonText));
|
||||
}
|
||||
// GD&T
|
||||
connect(ui->pbA01, &QPushButton::clicked, this, &TaskCustomizeFormat::onSymbolClicked);
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include <App/Document.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/UnitsApi.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
@@ -242,7 +241,7 @@ void TaskDetail::setUiFromFeat()
|
||||
// Base::Console().Message("TD::setUIFromFeat()\n");
|
||||
if (m_baseFeat) {
|
||||
std::string baseName = getBaseFeat()->getNameInDocument();
|
||||
ui->leBaseView->setText(Base::Tools::fromStdString(baseName));
|
||||
ui->leBaseView->setText(QString::fromStdString(baseName));
|
||||
}
|
||||
|
||||
Base::Vector3d anchor;
|
||||
@@ -485,7 +484,7 @@ void TaskDetail::updateDetail()
|
||||
double radius = ui->qsbRadius->rawValue();
|
||||
detailFeat->Radius.setValue(radius);
|
||||
QString qRef = ui->leReference->text();
|
||||
std::string ref = Base::Tools::toStdString(qRef);
|
||||
std::string ref = qRef.toStdString();
|
||||
detailFeat->Reference.setValue(ref);
|
||||
|
||||
detailFeat->recomputeFeature();
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#endif// #ifndef _PreComp_
|
||||
|
||||
#include <App/Document.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
@@ -68,12 +67,12 @@ void TaskDimRepair::setUiPrimary()
|
||||
ui->leName->setReadOnly(true);
|
||||
ui->leLabel->setReadOnly(true);
|
||||
|
||||
ui->leName->setText(Base::Tools::fromStdString(m_dim->getNameInDocument()));
|
||||
ui->leLabel->setText(Base::Tools::fromStdString(m_dim->Label.getValue()));
|
||||
ui->leName->setText(QString::fromStdString(m_dim->getNameInDocument()));
|
||||
ui->leLabel->setText(QString::fromStdString(m_dim->Label.getValue()));
|
||||
|
||||
std::string objName = m_dim->getViewPart()->getNameInDocument();
|
||||
std::string objLabel = m_dim->getViewPart()->Label.getValue();
|
||||
ui->leObject2d->setText(Base::Tools::fromStdString(objName + " / " + objLabel));
|
||||
ui->leObject2d->setText(QString::fromStdString(objName + " / " + objLabel));
|
||||
const std::vector<std::string>& subElements2d = m_dim->References2D.getSubValues();
|
||||
std::vector<std::string> noLabels(subElements2d.size());
|
||||
fillList(ui->lwGeometry2d, subElements2d, noLabels);
|
||||
@@ -164,7 +163,7 @@ void TaskDimRepair::updateUi()
|
||||
{
|
||||
std::string objName = m_dim->getViewPart()->getNameInDocument();
|
||||
std::string objLabel = m_dim->getViewPart()->Label.getValue();
|
||||
ui->leObject2d->setText(Base::Tools::fromStdString(objName + " / " + objLabel));
|
||||
ui->leObject2d->setText(QString::fromStdString(objName + " / " + objLabel));
|
||||
|
||||
std::vector<std::string> subElements2d;
|
||||
for (auto& ref : m_toApply2d) {
|
||||
@@ -182,15 +181,15 @@ void TaskDimRepair::loadTableWidget(QTableWidget* tw, ReferenceVector refs)
|
||||
tw->setRowCount(refs.size() + 1);
|
||||
size_t iRow = 0;
|
||||
for (auto& ref : refs) {
|
||||
QString qName = Base::Tools::fromStdString(ref.getObject()->getNameInDocument());
|
||||
QString qName = QString::fromStdString(ref.getObject()->getNameInDocument());
|
||||
QTableWidgetItem* itemName = new QTableWidgetItem(qName);
|
||||
itemName->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
tw->setItem(iRow, 0, itemName);
|
||||
QString qLabel = Base::Tools::fromStdString(std::string(ref.getObject()->Label.getValue()));
|
||||
QString qLabel = QString::fromStdString(std::string(ref.getObject()->Label.getValue()));
|
||||
QTableWidgetItem* itemLabel = new QTableWidgetItem(qLabel);
|
||||
itemLabel->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
tw->setItem(iRow, 1, itemLabel);
|
||||
QString qSubName = Base::Tools::fromStdString(ref.getSubName());
|
||||
QString qSubName = QString::fromStdString(ref.getSubName());
|
||||
QTableWidgetItem* itemSubName = new QTableWidgetItem(qSubName);
|
||||
itemSubName->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
tw->setItem(iRow, 2, itemSubName);
|
||||
@@ -209,8 +208,8 @@ void TaskDimRepair::fillList(QListWidget* lwItems, std::vector<std::string> labe
|
||||
int i = 0;
|
||||
lwItems->clear();
|
||||
for (; i < labelCount; i++) {
|
||||
qLabel = Base::Tools::fromStdString(labels[i]);
|
||||
qName = Base::Tools::fromStdString(names[i]);
|
||||
qLabel = QString::fromStdString(labels[i]);
|
||||
qName = QString::fromStdString(names[i]);
|
||||
qText = QString::fromUtf8("%1 %2").arg(qName, qLabel);
|
||||
item = new QListWidgetItem(qText, lwItems);
|
||||
item->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
@@ -234,7 +233,7 @@ bool TaskDimRepair::accept()
|
||||
{
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.ActiveDocument.resetEdit()");
|
||||
|
||||
Gui::Command::openCommand(Base::Tools::toStdString(tr("Repair Dimension")).c_str());
|
||||
Gui::Command::openCommand(tr("Repair Dimension").toStdString().c_str());
|
||||
replaceReferences();
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
#include <App/Document.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/Vector3D.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
@@ -94,7 +93,7 @@ void TaskGeomHatch::initUi()
|
||||
|
||||
void TaskGeomHatch::onFileChanged()
|
||||
{
|
||||
auto filespec = Base::Tools::toStdString(ui->fcFile->fileName());
|
||||
auto filespec = ui->fcFile->fileName().toStdString();
|
||||
m_file = DU::cleanFilespecBackslash(filespec);
|
||||
std::vector<std::string> names = PATLineSpec::getPatternList(m_file);
|
||||
QStringList qsNames = listToQ(names);
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/Vector3D.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
@@ -96,7 +95,7 @@ TaskHatch::~TaskHatch()
|
||||
void TaskHatch::setUiPrimary()
|
||||
{
|
||||
setWindowTitle(QObject::tr("Create Face Hatch"));
|
||||
ui->fcFile->setFileName(Base::Tools::fromStdString(DrawHatch::prefSvgHatch()));
|
||||
ui->fcFile->setFileName(QString::fromStdString(DrawHatch::prefSvgHatch()));
|
||||
ui->fcFile->setFilter(QString::fromUtf8(
|
||||
"SVG files (*.svg *.SVG);;Bitmap files(*.jpg *.jpeg *.png *.bmp);;All files (*)"));
|
||||
ui->sbScale->setValue(1.0);
|
||||
@@ -108,7 +107,7 @@ void TaskHatch::setUiPrimary()
|
||||
void TaskHatch::setUiEdit()
|
||||
{
|
||||
setWindowTitle(QObject::tr("Edit Face Hatch"));
|
||||
ui->fcFile->setFileName(Base::Tools::fromStdString(m_saveFile));
|
||||
ui->fcFile->setFileName(QString::fromStdString(m_saveFile));
|
||||
ui->fcFile->setFilter(QString::fromUtf8(
|
||||
"SVG files (*.svg *.SVG);;Bitmap files(*.jpg *.jpeg *.png *.bmp);;All files (*)"));
|
||||
ui->sbScale->setValue(m_saveScale);
|
||||
@@ -144,7 +143,7 @@ void TaskHatch::restoreHatchState()
|
||||
|
||||
void TaskHatch::onFileChanged()
|
||||
{
|
||||
m_file = Base::Tools::toStdString(ui->fcFile->fileName());
|
||||
m_file = ui->fcFile->fileName().toStdString();
|
||||
apply();
|
||||
}
|
||||
|
||||
@@ -209,7 +208,7 @@ void TaskHatch::createHatch()
|
||||
m_hatch = static_cast<TechDraw::DrawHatch *>(doc->getObject(FeatName.c_str()));
|
||||
m_hatch->Source.setValue(m_dvp, m_subs);
|
||||
|
||||
auto filespec = Base::Tools::toStdString(ui->fcFile->fileName());
|
||||
auto filespec = ui->fcFile->fileName().toStdString();
|
||||
filespec = DU::cleanFilespecBackslash(filespec);
|
||||
Command::doCommand(Command::Doc, "App.activeDocument().%s.HatchPattern = '%s'",
|
||||
FeatName.c_str(),
|
||||
@@ -239,7 +238,7 @@ void TaskHatch::updateHatch()
|
||||
|
||||
Command::openCommand(QT_TRANSLATE_NOOP("Command", "Update Hatch"));
|
||||
|
||||
auto filespec = Base::Tools::toStdString(ui->fcFile->fileName());
|
||||
auto filespec = ui->fcFile->fileName().toStdString();
|
||||
filespec = DU::cleanFilespecBackslash(filespec);
|
||||
Command::doCommand(Command::Doc, "App.activeDocument().%s.HatchPattern = '%s'",
|
||||
FeatName.c_str(),
|
||||
|
||||
@@ -221,7 +221,7 @@ void TaskLeaderLine::setUiPrimary()
|
||||
|
||||
if (m_baseFeat) {
|
||||
std::string baseName = m_baseFeat->getNameInDocument();
|
||||
ui->tbBaseView->setText(Base::Tools::fromStdString(baseName));
|
||||
ui->tbBaseView->setText(QString::fromStdString(baseName));
|
||||
}
|
||||
|
||||
ui->pbTracker->setText(tr("Pick points"));
|
||||
@@ -264,7 +264,7 @@ void TaskLeaderLine::setUiEdit()
|
||||
|
||||
if (m_lineFeat) {
|
||||
std::string baseName = m_lineFeat->LeaderParent.getValue()->getNameInDocument();
|
||||
ui->tbBaseView->setText(Base::Tools::fromStdString(baseName));
|
||||
ui->tbBaseView->setText(QString::fromStdString(baseName));
|
||||
|
||||
DrawGuiUtil::loadArrowBox(ui->cboxStartSym);
|
||||
ui->cboxStartSym->setCurrentIndex(m_lineFeat->StartSymbol.getValue());
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#endif // #ifndef _PreComp_
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
@@ -79,7 +78,7 @@ TaskLineDecor::~TaskLineDecor()
|
||||
void TaskLineDecor::initUi()
|
||||
{
|
||||
std::string viewName = m_partFeat->getNameInDocument();
|
||||
ui->le_View->setText(Base::Tools::fromStdString(viewName));
|
||||
ui->le_View->setText(QString::fromStdString(viewName));
|
||||
|
||||
std::stringstream ss;
|
||||
for (auto& e: m_edges) {
|
||||
@@ -90,7 +89,7 @@ void TaskLineDecor::initUi()
|
||||
if (!temp.empty()) {
|
||||
temp.resize(temp.length() - 2);
|
||||
}
|
||||
ui->le_Lines->setText(Base::Tools::fromStdString(temp));
|
||||
ui->le_Lines->setText(QString::fromStdString(temp));
|
||||
|
||||
ui->cc_Color->setColor(m_color.asValue<QColor>());
|
||||
ui->dsb_Weight->setValue(m_weight);
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include <App/Document.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
@@ -167,7 +166,7 @@ void TaskRichAnno::setUiPrimary()
|
||||
|
||||
if (m_baseFeat) {
|
||||
std::string baseName = m_baseFeat->getNameInDocument();
|
||||
ui->leBaseView->setText(Base::Tools::fromStdString(baseName));
|
||||
ui->leBaseView->setText(QString::fromStdString(baseName));
|
||||
}
|
||||
ui->dsbWidth->setUnit(Base::Unit::Length);
|
||||
ui->dsbWidth->setMinimum(0);
|
||||
@@ -210,7 +209,7 @@ void TaskRichAnno::setUiEdit()
|
||||
if (docObj) {
|
||||
baseName = docObj->getNameInDocument();
|
||||
}
|
||||
ui->leBaseView->setText(Base::Tools::fromStdString(baseName));
|
||||
ui->leBaseView->setText(QString::fromStdString(baseName));
|
||||
ui->teAnnoText->setHtml(QString::fromUtf8(m_annoFeat->AnnoText.getValue()));
|
||||
ui->dsbMaxWidth->setValue(m_annoFeat->MaxWidth.getValue());
|
||||
ui->cbShowFrame->setChecked(m_annoFeat->ShowFrame.getValue());
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Control.h>
|
||||
@@ -159,7 +158,7 @@ void TaskSectionView::setUiEdit()
|
||||
// Base::Console().Message("TSV::setUiEdit()\n");
|
||||
setWindowTitle(QObject::tr("Edit Section View"));
|
||||
std::string temp = m_section->SectionSymbol.getValue();
|
||||
QString qTemp = Base::Tools::fromStdString(temp);
|
||||
QString qTemp = QString::fromStdString(temp);
|
||||
ui->leSymbol->setText(qTemp);
|
||||
|
||||
ui->sbScale->setValue(m_section->getScale());
|
||||
@@ -188,7 +187,7 @@ void TaskSectionView::setUiEdit()
|
||||
void TaskSectionView::setUiCommon(Base::Vector3d origin)
|
||||
{
|
||||
std::string temp = m_base->getNameInDocument();
|
||||
QString qTemp = Base::Tools::fromStdString(temp);
|
||||
QString qTemp = QString::fromStdString(temp);
|
||||
ui->leBaseView->setText(qTemp);
|
||||
|
||||
ui->sbOrgX->setUnit(Base::Unit::Length);
|
||||
@@ -441,7 +440,7 @@ bool TaskSectionView::apply(bool forceUpdate)
|
||||
if (m_dirName.empty()) {
|
||||
//this should never happen
|
||||
std::string msg =
|
||||
Base::Tools::toStdString(tr("Nothing to apply. No section direction picked yet"));
|
||||
tr("Nothing to apply. No section direction picked yet").toStdString();
|
||||
Base::Console().Error((msg + "\n").c_str());
|
||||
return false;
|
||||
}
|
||||
@@ -512,7 +511,7 @@ TechDraw::DrawViewSection* TaskSectionView::createSectionView(void)
|
||||
// we pluck the generated suffix from the object name and append it to "Section" to generate
|
||||
// unique Labels
|
||||
QString qTemp = ui->leSymbol->text();
|
||||
std::string temp = Base::Tools::toStdString(qTemp);
|
||||
std::string temp = qTemp.toStdString();
|
||||
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.SectionSymbol = '%s'",
|
||||
m_sectionName.c_str(), temp.c_str());
|
||||
|
||||
@@ -592,7 +591,7 @@ void TaskSectionView::updateSectionView()
|
||||
ui->sbOrgY->value().getValue(), ui->sbOrgZ->value().getValue());
|
||||
|
||||
QString qTemp = ui->leSymbol->text();
|
||||
std::string temp = Base::Tools::toStdString(qTemp);
|
||||
std::string temp = qTemp.toStdString();
|
||||
Command::doCommand(Command::Doc, "App.ActiveDocument.%s.SectionSymbol = '%s'",
|
||||
m_sectionName.c_str(), temp.c_str());
|
||||
|
||||
@@ -635,14 +634,14 @@ std::string TaskSectionView::makeSectionLabel(QString symbol)
|
||||
const std::string objectName("SectionView");
|
||||
std::string uniqueSuffix{m_sectionName.substr(objectName.length(), std::string::npos)};
|
||||
std::string uniqueLabel = "Section" + uniqueSuffix;
|
||||
std::string temp = Base::Tools::toStdString(symbol);
|
||||
std::string temp = symbol.toStdString();
|
||||
return ( uniqueLabel + " " + temp + " - " + temp );
|
||||
}
|
||||
|
||||
void TaskSectionView::failNoObject(void)
|
||||
{
|
||||
QString qsectionName = Base::Tools::fromStdString(m_sectionName);
|
||||
QString qbaseName = Base::Tools::fromStdString(m_baseName);
|
||||
QString qsectionName = QString::fromStdString(m_sectionName);
|
||||
QString qbaseName = QString::fromStdString(m_baseName);
|
||||
QString msg = tr("Can not continue. Object * %1 or %2 not found.").arg(qsectionName, qbaseName);
|
||||
QMessageBox::critical(Gui::getMainWindow(), QObject::tr("Operation Failed"), msg);
|
||||
Gui::Control().closeDialog();
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#endif // #ifndef _PreCmp_
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawTemplate.h>
|
||||
#include <Mod/TechDraw/App/DrawSVGTemplate.h>
|
||||
@@ -78,7 +77,7 @@ void TemplateTextField::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
|
||||
ui.setFieldName(fieldNameStr);
|
||||
ui.setFieldContent(tmplte->EditableTexts[fieldNameStr]);
|
||||
ui.setAutofillContent(Base::Tools::toStdString(m_autofillString));
|
||||
ui.setAutofillContent(m_autofillString.toStdString());
|
||||
|
||||
if (ui.exec() == QDialog::Accepted) {
|
||||
QString qsClean = ui.getFieldContent();
|
||||
@@ -86,7 +85,7 @@ void TemplateTextField::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
if (ui.getAutofillState()) {
|
||||
auto svgTemplate = dynamic_cast<DrawSVGTemplate*>(tmplte);
|
||||
if (svgTemplate) {
|
||||
QString fieldName = Base::Tools::fromStdString(fieldNameStr);
|
||||
QString fieldName = QString::fromStdString(fieldNameStr);
|
||||
QString autofillValue = svgTemplate->getAutofillByEditableName(fieldName);
|
||||
if (!autofillValue.isEmpty()) {
|
||||
utf8Content = autofillValue.toUtf8().constData();
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Control.h>
|
||||
#include <Gui/Document.h>
|
||||
@@ -364,8 +363,8 @@ void ViewProviderDrawingView::onProgressMessage(const TechDraw::DrawView* dv,
|
||||
void ViewProviderDrawingView::showProgressMessage(const std::string featureName, const std::string text) const
|
||||
{
|
||||
QString msg = QString::fromUtf8("%1 %2")
|
||||
.arg(Base::Tools::fromStdString(featureName),
|
||||
Base::Tools::fromStdString(text));
|
||||
.arg(QString::fromStdString(featureName),
|
||||
QString::fromStdString(text));
|
||||
if (Gui::getMainWindow()) {
|
||||
//neither of these work! Base::Console().Message() output preempts these messages??
|
||||
// Gui::getMainWindow()->showMessage(msg, 3000);
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <Mod/TechDraw/TechDrawGlobal.h>
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
|
||||
#include "CompassDialWidget.h"
|
||||
|
||||
@@ -151,7 +150,7 @@ void CompassDialWidget::drawMarkings(QPainter& painter)
|
||||
if (iDegree % 45 == 0) {
|
||||
//Named direction (every 45°)
|
||||
painter.drawLine(0, -40, 0, -50); //this has to depend on m_rect or size?
|
||||
QString qPointText = Base::Tools::fromStdString(CompassPointText.at(iDegree));
|
||||
QString qPointText = QString::fromStdString(CompassPointText.at(iDegree));
|
||||
painter.drawText(-metrics.boundingRect(qPointText).width() / 2.0, -52, qPointText);
|
||||
// what is -52? line end point y = -50 + 2 for margin?
|
||||
} else {
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
#include <limits>
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/UnitsApi.h>
|
||||
|
||||
#include <Gui/SpinBox.h>
|
||||
@@ -96,7 +95,7 @@ bool VectorEditWidget::eventFilter(QObject *target, QEvent *event)
|
||||
}
|
||||
void VectorEditWidget::setLabel(std::string newLabel)
|
||||
{
|
||||
QString qNewLabelString = Base::Tools::fromStdString(newLabel);
|
||||
QString qNewLabelString = QString::fromStdString(newLabel);
|
||||
lvectorName->setText(qNewLabelString);
|
||||
}
|
||||
|
||||
@@ -178,7 +177,7 @@ void VectorEditWidget::slotZValueChanged(double newValue)
|
||||
void VectorEditWidget::updateDisplay()
|
||||
{
|
||||
// Base::Console().Message("VEW::updateDisplay() - m_value: %s\n", DrawUtil::formatVector(m_value).c_str());
|
||||
QString qNewDisplayString = Base::Tools::fromStdString(DrawUtil::formatVector(m_value));
|
||||
QString qNewDisplayString = QString::fromStdString(DrawUtil::formatVector(m_value));
|
||||
leVectorDisplay->setText(qNewDisplayString);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/FileDialog.h>
|
||||
#include <Mod/TechDraw/App/Preferences.h>
|
||||
|
||||
@@ -812,7 +811,7 @@ void MRichTextEdit::setDefFont(QString fontName)
|
||||
|
||||
QFont MRichTextEdit::getDefFont()
|
||||
{
|
||||
QString family = Base::Tools::fromStdString(Preferences::labelFont());
|
||||
QString family = QString::fromStdString(Preferences::labelFont());
|
||||
m_defFont = family;
|
||||
QFont result;
|
||||
result.setFamily(family);
|
||||
|
||||
Reference in New Issue
Block a user