Fix updating dimension labels in Valentina app.
This commit is contained in:
parent
22d21a867a
commit
57dd27cec0
|
@ -11,6 +11,7 @@
|
||||||
- Tape app. "Export from existing ..." now supports multisize measurements.
|
- Tape app. "Export from existing ..." now supports multisize measurements.
|
||||||
- Fix main path validation. False positive double curve.
|
- Fix main path validation. False positive double curve.
|
||||||
- Fix Setup multisize measurements dialog. Improved handling Height dimension.
|
- Fix Setup multisize measurements dialog. Improved handling Height dimension.
|
||||||
|
- Fix updating dimension labels in Valentina app.
|
||||||
|
|
||||||
# Valentina 0.7.51 April 18, 2022
|
# Valentina 0.7.51 April 18, 2022
|
||||||
- Z value change for a layout piece.
|
- Z value change for a layout piece.
|
||||||
|
|
|
@ -2815,11 +2815,12 @@ void TMainWindow::InitDimensionGradation(int index, const MeasurementDimension_p
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
control->addItem(QString("%1 %2").arg(base).arg(unit), base);
|
control->addItem(QStringLiteral("%1 %2").arg(base).arg(unit), base);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (dimension->Type() == MeasurementDimension::Y)
|
else if (dimension->Type() == MeasurementDimension::Y || dimension->Type() == MeasurementDimension::W ||
|
||||||
|
dimension->Type() == MeasurementDimension::Z)
|
||||||
{
|
{
|
||||||
for(auto base : bases)
|
for(auto base : bases)
|
||||||
{
|
{
|
||||||
|
@ -2831,7 +2832,7 @@ void TMainWindow::InitDimensionGradation(int index, const MeasurementDimension_p
|
||||||
{
|
{
|
||||||
if (dimension->IsBodyMeasurement())
|
if (dimension->IsBodyMeasurement())
|
||||||
{
|
{
|
||||||
control->addItem(QString("%1 %2").arg(fc ? base*2 : base).arg(unit), base);
|
control->addItem(QStringLiteral("%1 %2").arg(fc ? base*2 : base).arg(unit), base);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2840,20 +2841,6 @@ void TMainWindow::InitDimensionGradation(int index, const MeasurementDimension_p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (dimension->Type() == MeasurementDimension::W || dimension->Type() == MeasurementDimension::Z)
|
|
||||||
{
|
|
||||||
for(auto base : bases)
|
|
||||||
{
|
|
||||||
if (labels.contains(base) && not labels.value(base).isEmpty())
|
|
||||||
{
|
|
||||||
control->addItem(labels.value(base), base);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
control->addItem(QString("%1 %2").arg(fc ? base*2 : base).arg(unit), base);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// after initialization the current index is 0. The signal for changing the index will not be triggered if not make
|
// after initialization the current index is 0. The signal for changing the index will not be triggered if not make
|
||||||
// it invalid first
|
// it invalid first
|
||||||
|
@ -2878,7 +2865,7 @@ void TMainWindow::InitDimensionControls()
|
||||||
const QList<MeasurementDimension_p> dimensions = m->Dimensions().values();
|
const QList<MeasurementDimension_p> dimensions = m->Dimensions().values();
|
||||||
const QString unit = UnitsToStr(m->Units(), true);
|
const QString unit = UnitsToStr(m->Units(), true);
|
||||||
|
|
||||||
auto InitControl = [this, dimensions, unit](int index, QLabel *&name, QComboBox *&control)
|
auto InitControl = [this, dimensions](int index, QLabel *&name, QComboBox *&control)
|
||||||
{
|
{
|
||||||
if (dimensions.size() > index)
|
if (dimensions.size() > index)
|
||||||
{
|
{
|
||||||
|
|
|
@ -592,7 +592,8 @@ bool MainWindow::UpdateMeasurements(const QString &path, qreal baseA, qreal base
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool MainWindow::UpdateMeasurements(const QSharedPointer<VMeasurements> &mFile, qreal baseA, qreal baseB, qreal baseC)
|
auto MainWindow::UpdateMeasurements(const QSharedPointer<VMeasurements> &mFile, qreal baseA, qreal baseB,
|
||||||
|
qreal baseC) -> bool
|
||||||
{
|
{
|
||||||
m = mFile;
|
m = mFile;
|
||||||
|
|
||||||
|
@ -606,7 +607,7 @@ bool MainWindow::UpdateMeasurements(const QSharedPointer<VMeasurements> &mFile,
|
||||||
qCCritical(vMainWindow, "%s", qUtf8Printable(tr("Measurement files types have not match.")));
|
qCCritical(vMainWindow, "%s", qUtf8Printable(tr("Measurement files types have not match.")));
|
||||||
if (not VApplication::IsGUIMode())
|
if (not VApplication::IsGUIMode())
|
||||||
{
|
{
|
||||||
qApp->exit(V_EX_DATAERR);
|
QCoreApplication::exit(V_EX_DATAERR);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -617,8 +618,50 @@ bool MainWindow::UpdateMeasurements(const QSharedPointer<VMeasurements> &mFile,
|
||||||
|
|
||||||
if (not m->Dimensions().isEmpty())
|
if (not m->Dimensions().isEmpty())
|
||||||
{
|
{
|
||||||
InitDimensionGradation(0, m->Dimensions().values().at(0), dimensionA);
|
const QList<MeasurementDimension_p> dimensions = m->Dimensions().values();
|
||||||
DimensionABaseChanged();
|
|
||||||
|
auto InitDimensionLabel = [this, dimensions](const MeasurementDimension_p& dimension,
|
||||||
|
QPointer<QLabel> &name, QPointer<QComboBox> &control)
|
||||||
|
{
|
||||||
|
if (dimension.isNull())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name == nullptr)
|
||||||
|
{
|
||||||
|
name = new QLabel(dimension->Name()+QChar(':'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
name->setText(dimension->Name()+QChar(':'));
|
||||||
|
}
|
||||||
|
name->setToolTip(VAbstartMeasurementDimension::DimensionToolTip(dimension, m->IsFullCircumference()));
|
||||||
|
|
||||||
|
if (control == nullptr)
|
||||||
|
{
|
||||||
|
control = new QComboBox;
|
||||||
|
control->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
MeasurementDimension_p dimension = dimensions.at(0);
|
||||||
|
InitDimensionLabel(dimension, dimensionALabel, dimensionA);
|
||||||
|
InitDimensionGradation(0, dimension, dimensionA);
|
||||||
|
|
||||||
|
if (dimensions.size() > 1)
|
||||||
|
{
|
||||||
|
dimension = dimensions.at(1);
|
||||||
|
InitDimensionLabel(dimension, dimensionBLabel, dimensionB);
|
||||||
|
InitDimensionGradation(1, dimension, dimensionB);
|
||||||
|
|
||||||
|
if (dimensions.size() > 2)
|
||||||
|
{
|
||||||
|
dimension = dimensions.at(2);
|
||||||
|
InitDimensionLabel(dimension, dimensionCLabel, dimensionC);
|
||||||
|
InitDimensionGradation(2, dimension, dimensionC);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m->StoreNames(false);
|
m->StoreNames(false);
|
||||||
|
@ -636,13 +679,11 @@ bool MainWindow::UpdateMeasurements(const QSharedPointer<VMeasurements> &mFile,
|
||||||
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
|
||||||
if (not VApplication::IsGUIMode())
|
if (not VApplication::IsGUIMode())
|
||||||
{
|
{
|
||||||
qApp->exit(V_EX_NOINPUT);
|
QCoreApplication::exit(V_EX_NOINPUT);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4600,11 +4641,12 @@ void MainWindow::InitDimensionGradation(int index, const MeasurementDimension_p
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
control->addItem(QString("%1 %2").arg(base).arg(unit), base);
|
control->addItem(QStringLiteral("%1 %2").arg(base).arg(unit), base);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (dimension->Type() == MeasurementDimension::Y)
|
else if (dimension->Type() == MeasurementDimension::Y || dimension->Type() == MeasurementDimension::W ||
|
||||||
|
dimension->Type() == MeasurementDimension::Z)
|
||||||
{
|
{
|
||||||
for(auto base : bases)
|
for(auto base : bases)
|
||||||
{
|
{
|
||||||
|
@ -4616,7 +4658,7 @@ void MainWindow::InitDimensionGradation(int index, const MeasurementDimension_p
|
||||||
{
|
{
|
||||||
if (dimension->IsBodyMeasurement())
|
if (dimension->IsBodyMeasurement())
|
||||||
{
|
{
|
||||||
control->addItem(QString("%1 %2").arg(fc ? base*2 : base).arg(unit), base);
|
control->addItem(QStringLiteral("%1 %2").arg(fc ? base*2 : base).arg(unit), base);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -4625,20 +4667,6 @@ void MainWindow::InitDimensionGradation(int index, const MeasurementDimension_p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (dimension->Type() == MeasurementDimension::W || dimension->Type() == MeasurementDimension::Z)
|
|
||||||
{
|
|
||||||
for(auto base : bases)
|
|
||||||
{
|
|
||||||
if (labels.contains(base) && not labels.value(base).isEmpty())
|
|
||||||
{
|
|
||||||
control->addItem(labels.value(base), base);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
control->addItem(QString("%1 %2").arg(fc ? base*2 : base).arg(unit), base);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// after initialization the current index is 0. The signal for changing the index will not be triggered if not make
|
// after initialization the current index is 0. The signal for changing the index will not be triggered if not make
|
||||||
// it invalid first
|
// it invalid first
|
||||||
|
|
Loading…
Reference in New Issue
Block a user