Block signals when set a measurement units.
This commit is contained in:
parent
ab5892d3ef
commit
31c0a523e4
|
@ -1618,8 +1618,10 @@ void TMainWindow::ShowNewMData(bool fresh)
|
||||||
connect(ui->lineEditName, &QLineEdit::textEdited, this, &TMainWindow::SaveMName);
|
connect(ui->lineEditName, &QLineEdit::textEdited, this, &TMainWindow::SaveMName);
|
||||||
ui->plainTextEditDescription->blockSignals(false);
|
ui->plainTextEditDescription->blockSignals(false);
|
||||||
|
|
||||||
|
ui->comboBoxMUnits->blockSignals(true);
|
||||||
ui->comboBoxMUnits->setCurrentIndex(
|
ui->comboBoxMUnits->setCurrentIndex(
|
||||||
ui->comboBoxMUnits->findData(static_cast<int>(meash->IsSpecialUnits() ? MUnits::Degrees : MUnits::Table)));
|
ui->comboBoxMUnits->findData(static_cast<int>(meash->IsSpecialUnits() ? MUnits::Degrees : MUnits::Table)));
|
||||||
|
ui->comboBoxMUnits->blockSignals(false);
|
||||||
|
|
||||||
if (mType == MeasurementsType::Multisize)
|
if (mType == MeasurementsType::Multisize)
|
||||||
{
|
{
|
||||||
|
@ -1633,17 +1635,17 @@ void TMainWindow::ShowNewMData(bool fresh)
|
||||||
QString calculatedValue;
|
QString calculatedValue;
|
||||||
|
|
||||||
if (meash->IsSpecialUnits())
|
if (meash->IsSpecialUnits())
|
||||||
|
{
|
||||||
|
const qreal value = *data->DataVariables()->value(meash->GetName())->GetValue();
|
||||||
|
calculatedValue = qApp->LocaleToString(value) + QChar(QChar::Space) + degreeSymbol;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
const QString postfix = UnitsToStr(pUnit);//Show unit in dialog lable (cm, mm or inch)
|
const QString postfix = UnitsToStr(pUnit);//Show unit in dialog lable (cm, mm or inch)
|
||||||
const qreal value = UnitConvertor(*data->DataVariables()->value(meash->GetName())->GetValue(), mUnit,
|
const qreal value = UnitConvertor(*data->DataVariables()->value(meash->GetName())->GetValue(), mUnit,
|
||||||
pUnit);
|
pUnit);
|
||||||
calculatedValue = qApp->LocaleToString(value) + QChar(QChar::Space) + postfix;
|
calculatedValue = qApp->LocaleToString(value) + QChar(QChar::Space) + postfix;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
const qreal value = *data->DataVariables()->value(meash->GetName())->GetValue();
|
|
||||||
calculatedValue = qApp->LocaleToString(value) + QChar(QChar::Space) + degreeSymbol;
|
|
||||||
}
|
|
||||||
ui->labelCalculatedValue->setText(calculatedValue);
|
ui->labelCalculatedValue->setText(calculatedValue);
|
||||||
|
|
||||||
if (fresh)
|
if (fresh)
|
||||||
|
@ -2245,7 +2247,6 @@ void TMainWindow::InitWindow()
|
||||||
SetDimensionBases();
|
SetDimensionBases();
|
||||||
|
|
||||||
InitDimesionShifts();
|
InitDimesionShifts();
|
||||||
HackDimensionShifts();
|
|
||||||
|
|
||||||
connect(ui->doubleSpinBoxBaseValue, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
connect(ui->doubleSpinBoxBaseValue, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||||
this, &TMainWindow::SaveMBaseValue);
|
this, &TMainWindow::SaveMBaseValue);
|
||||||
|
@ -2259,6 +2260,8 @@ void TMainWindow::InitWindow()
|
||||||
connect(ui->doubleSpinBoxShiftC, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
connect(ui->doubleSpinBoxShiftC, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||||
this, &TMainWindow::SaveMShiftC);
|
this, &TMainWindow::SaveMShiftC);
|
||||||
|
|
||||||
|
HackDimensionShifts();
|
||||||
|
|
||||||
SetDecimals();
|
SetDecimals();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3457,7 +3460,7 @@ void TMainWindow::HackDimensionShifts()
|
||||||
{
|
{
|
||||||
const QList<MeasurementDimension_p> dimensions = m->Dimensions().values();
|
const QList<MeasurementDimension_p> dimensions = m->Dimensions().values();
|
||||||
|
|
||||||
auto HackShift = [this, dimensions](int index, QLabel *name, QDoubleSpinBox *shift)
|
auto HackShift = [this, dimensions](int index, QLabel *&name, QDoubleSpinBox *&shift)
|
||||||
{
|
{
|
||||||
SCASSERT(name != nullptr)
|
SCASSERT(name != nullptr)
|
||||||
SCASSERT(shift != nullptr)
|
SCASSERT(shift != nullptr)
|
||||||
|
@ -3470,8 +3473,8 @@ void TMainWindow::HackDimensionShifts()
|
||||||
};
|
};
|
||||||
|
|
||||||
HackShift(0, ui->labelShiftA, ui->doubleSpinBoxShiftA);
|
HackShift(0, ui->labelShiftA, ui->doubleSpinBoxShiftA);
|
||||||
HackShift(0, ui->labelShiftB, ui->doubleSpinBoxShiftB);
|
HackShift(1, ui->labelShiftB, ui->doubleSpinBoxShiftB);
|
||||||
HackShift(0, ui->labelShiftC, ui->doubleSpinBoxShiftC);
|
HackShift(2, ui->labelShiftC, ui->doubleSpinBoxShiftC);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -3840,6 +3843,24 @@ void TMainWindow::SetDimensionBases()
|
||||||
{
|
{
|
||||||
const QList<MeasurementDimension_p> dimensions = m->Dimensions().values();
|
const QList<MeasurementDimension_p> dimensions = m->Dimensions().values();
|
||||||
|
|
||||||
|
if (dimensions.size() > 0)
|
||||||
|
{
|
||||||
|
MeasurementDimension_p dimension = dimensions.at(0);
|
||||||
|
currentDimensionA = dimension->BaseValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dimensions.size() > 1)
|
||||||
|
{
|
||||||
|
MeasurementDimension_p dimension = dimensions.at(1);
|
||||||
|
currentDimensionB = dimension->BaseValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dimensions.size() > 2)
|
||||||
|
{
|
||||||
|
MeasurementDimension_p dimension = dimensions.at(2);
|
||||||
|
currentDimensionC = dimension->BaseValue();
|
||||||
|
}
|
||||||
|
|
||||||
auto SetBase = [dimensions](int index, QComboBox *control, int &value)
|
auto SetBase = [dimensions](int index, QComboBox *control, int &value)
|
||||||
{
|
{
|
||||||
if (dimensions.size() > index)
|
if (dimensions.size() > index)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user