[TD] Fix regression in Dimensions: Setting arbitrary under tolerance was somehow lost.

This commit is contained in:
Aapo
2021-01-24 17:49:12 +02:00
committed by wwmayer
parent 4ab3c95552
commit d26b6542ca
3 changed files with 15 additions and 11 deletions

View File

@@ -111,7 +111,8 @@ DrawViewDimension::DrawViewDimension(void)
References3D.setScope(App::LinkScope::Global);
ADD_PROPERTY_TYPE(FormatSpec, (getDefaultFormatSpec()), "Format", App::Prop_Output,"Dimension Format");
ADD_PROPERTY_TYPE(FormatSpecTolerance, (getDefaultFormatSpec(true)), "Format", App::Prop_Output, "Dimension tolerance format");
ADD_PROPERTY_TYPE(FormatSpecUnderTolerance, (getDefaultFormatSpec(true)), "Format", App::Prop_Output, "Dimension tolerance format");
ADD_PROPERTY_TYPE(FormatSpecOverTolerance, (getDefaultFormatSpec(true)), "Format", App::Prop_Output, "Dimension tolerance format");
ADD_PROPERTY_TYPE(Arbitrary,(false), "Format", App::Prop_Output, "Value overridden by user");
ADD_PROPERTY_TYPE(ArbitraryTolerances, (false), "Format", App::Prop_Output, "Tolerance values overridden by user");
@@ -846,11 +847,12 @@ std::string DrawViewDimension::formatValue(qreal value, QString qFormatSpec, int
}
return result;
}
std::string DrawViewDimension::getFormattedToleranceValue(int partial)
{
QString FormatSpec = QString::fromUtf8(FormatSpecTolerance.getStrValue().data());
QString FormatSpec = QString::fromUtf8(FormatSpecOverTolerance.getStrValue().data());
QString ToleranceString;
if (ArbitraryTolerances.getValue())
@@ -863,25 +865,26 @@ std::string DrawViewDimension::getFormattedToleranceValue(int partial)
std::pair<std::string, std::string> DrawViewDimension::getFormattedToleranceValues(int partial)
{
QString FormatSpec = QString::fromUtf8(FormatSpecTolerance.getStrValue().data());
QString underFormatSpec = QString::fromUtf8(FormatSpecUnderTolerance.getStrValue().data());
QString overFormatSpec = QString::fromUtf8(FormatSpecOverTolerance.getStrValue().data());
std::pair<std::string, std::string> tolerances;
QString underTolerance, overTolerance;
if (ArbitraryTolerances.getValue()) {
underTolerance = FormatSpec;
overTolerance = FormatSpec;
underTolerance = underFormatSpec;
overTolerance = overFormatSpec;
} else {
if (DrawUtil::fpCompare(UnderTolerance.getValue(), 0.0)) {
underTolerance = QString::fromUtf8(formatValue(UnderTolerance.getValue(), QString::fromUtf8("%.0f"), partial).c_str());
}
else {
underTolerance = QString::fromUtf8(formatValue(UnderTolerance.getValue(), FormatSpec, partial).c_str());
underTolerance = QString::fromUtf8(formatValue(UnderTolerance.getValue(), underFormatSpec, partial).c_str());
}
if (DrawUtil::fpCompare(OverTolerance.getValue(), 0.0)) {
overTolerance = QString::fromUtf8(formatValue(OverTolerance.getValue(), QString::fromUtf8("%.0f"), partial).c_str());
}
else {
overTolerance = QString::fromUtf8(formatValue(OverTolerance.getValue(), FormatSpec, partial).c_str());
overTolerance = QString::fromUtf8(formatValue(OverTolerance.getValue(), overFormatSpec, partial).c_str());
}
}

View File

@@ -102,7 +102,8 @@ public:
App::PropertyBool TheoreticalExact;
App::PropertyBool Inverted;
App::PropertyString FormatSpec;
App::PropertyString FormatSpecTolerance;
App::PropertyString FormatSpecUnderTolerance;
App::PropertyString FormatSpecOverTolerance;
App::PropertyBool Arbitrary;
App::PropertyBool ArbitraryTolerances;
App::PropertyBool EqualTolerance;

View File

@@ -98,7 +98,7 @@ TaskDimension::TaskDimension(QGIViewDimension *parent, ViewProviderDimension *di
connect(ui->leFormatSpecifier, SIGNAL(textChanged(QString)), this, SLOT(onFormatSpecifierChanged()));
ui->cbArbitrary->setChecked(parent->dvDimension->Arbitrary.getValue());
connect(ui->cbArbitrary, SIGNAL(stateChanged(int)), this, SLOT(onArbitraryChanged()));
StringValue = parent->dvDimension->FormatSpecTolerance.getValue();
StringValue = parent->dvDimension->FormatSpecOverTolerance.getValue();
qs = QString::fromUtf8(StringValue.data(), StringValue.size());
ui->leToleranceFormatSpecifier->setText(qs);
connect(ui->leToleranceFormatSpecifier, SIGNAL(textChanged(QString)), this, SLOT(onToleranceFormatSpecifierChanged()));
@@ -133,7 +133,7 @@ bool TaskDimension::accept()
m_parent->dvDimension->FormatSpec.setValue(ui->leFormatSpecifier->text().toUtf8().constData());
m_parent->dvDimension->Arbitrary.setValue(ui->cbArbitrary->isChecked());
m_parent->dvDimension->FormatSpecTolerance.setValue(ui->leToleranceFormatSpecifier->text().toUtf8().constData());
m_parent->dvDimension->FormatSpecOverTolerance.setValue(ui->leToleranceFormatSpecifier->text().toUtf8().constData());
m_parent->dvDimension->ArbitraryTolerances.setValue(ui->cbArbitraryTolerances->isChecked());
m_dimensionVP->FlipArrowheads.setValue(ui->cbArrowheads->isChecked());
@@ -234,7 +234,7 @@ void TaskDimension::onArbitraryChanged()
void TaskDimension::onToleranceFormatSpecifierChanged()
{
m_parent->dvDimension->FormatSpecTolerance.setValue(ui->leToleranceFormatSpecifier->text().toUtf8().constData());
m_parent->dvDimension->FormatSpecOverTolerance.setValue(ui->leToleranceFormatSpecifier->text().toUtf8().constData());
recomputeFeature();
}