diff --git a/src/Mod/TechDraw/App/DrawViewDimension.cpp b/src/Mod/TechDraw/App/DrawViewDimension.cpp index a1b1a4b290..764f4a3a2c 100644 --- a/src/Mod/TechDraw/App/DrawViewDimension.cpp +++ b/src/Mod/TechDraw/App/DrawViewDimension.cpp @@ -213,7 +213,6 @@ short DrawViewDimension::mustExecute() const App::DocumentObjectExecReturn *DrawViewDimension::execute(void) { -// Base::Console().Message("DVD::execute() - %s\n", getNameInDocument()); if (!keepUpdated()) { return App::DocumentObject::StdReturn; } @@ -685,14 +684,13 @@ std::string DrawViewDimension::formatValue(qreal value, QString qFormatSpec, int } return result; - } -QStringList DrawViewDimension::getFormattedToleranceValues(int partial) +std::pair DrawViewDimension::getFormattedToleranceValues(int partial) { QString underFormatSpec = QString::fromUtf8(FormatSpecUnderTolerance.getStrValue().data()); QString overFormatSpec = QString::fromUtf8(FormatSpecOverTolerance.getStrValue().data()); - QStringList tolerances; + std::pair tolerances; QString underTolerance, overTolerance; if (ArbitraryTolerances.getValue()) { @@ -703,7 +701,8 @@ QStringList DrawViewDimension::getFormattedToleranceValues(int partial) overTolerance = QString::fromUtf8(formatValue(OverTolerance.getValue(), overFormatSpec, partial).c_str()); } - tolerances << underTolerance << overTolerance; + tolerances.first = underTolerance.toStdString(); + tolerances.second = overTolerance.toStdString(); return tolerances; } @@ -728,7 +727,7 @@ QStringList DrawViewDimension::getPrefixSuffixSpec(QString fSpec) QString formatSuffix; QString formatted; //find the %x.y tag in FormatSpec - QRegExp rxFormat(QString::fromUtf8("%[+-]*[0-9]*\\.*[0-9]*[aefgAEFG]")); //printf double format spec + QRegExp rxFormat(QString::fromUtf8("%[+-]?[0-9]*\\.*[0-9]*[aefgAEFG]")); //printf double format spec QString match; int pos = 0; if ((pos = rxFormat.indexIn(fSpec, 0)) != -1) { diff --git a/src/Mod/TechDraw/App/DrawViewDimension.h b/src/Mod/TechDraw/App/DrawViewDimension.h index ed739b29cd..c1ca7ed180 100644 --- a/src/Mod/TechDraw/App/DrawViewDimension.h +++ b/src/Mod/TechDraw/App/DrawViewDimension.h @@ -136,7 +136,7 @@ public: //return PyObject as DrawViewDimensionPy virtual PyObject *getPyObject(void) override; - virtual QStringList getFormattedToleranceValues(int partial = 0); + virtual std::pair getFormattedToleranceValues(int partial = 0); virtual std::string getFormattedDimensionValue(int partial = 0); virtual std::string formatValue(qreal value, QString qFormatSpec, int partial = 0); diff --git a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp index 8ebb16ad13..75a2da471b 100644 --- a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp @@ -333,23 +333,25 @@ void QGIDatumLabel::setTolString() tolSuffix = QString::fromUtf8(dim->getFormattedDimensionValue(2).c_str()); //just the unit } - QStringList labelTexts, unitTexts; + std::pair labelTexts, unitTexts; if (dim->ArbitraryTolerances.getValue()) { labelTexts = dim->getFormattedToleranceValues(1); //just the number pref/spec/suf - unitTexts << QString::fromLatin1("") << QString::fromLatin1(""); + unitTexts.first = ""; + unitTexts.second = ""; } else { if (dim->isMultiValueSchema()) { labelTexts = dim->getFormattedToleranceValues(0); //don't format multis - unitTexts << QString::fromLatin1("") << QString::fromLatin1(""); + unitTexts.first = ""; + unitTexts.second = ""; } else { labelTexts = dim->getFormattedToleranceValues(1); //just the number pref/spec/suf unitTexts = dim->getFormattedToleranceValues(2); //just the unit } } - m_tolTextUnder->setPlainText(labelTexts[0] + unitTexts[0]); - m_tolTextOver->setPlainText(labelTexts[1] + unitTexts[1]); + m_tolTextUnder->setPlainText(QString::fromUtf8(labelTexts.first.c_str()) + QString::fromUtf8(unitTexts.first.c_str())); + m_tolTextOver->setPlainText(QString::fromUtf8(labelTexts.second.c_str()) + QString::fromUtf8(unitTexts.second.c_str())); return; }