diff --git a/ChangeLog.txt b/ChangeLog.txt index bb949656d..bb5163e2d 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -16,6 +16,7 @@ - [#942] Save Layout mode ignores paper format for tiled PDF. - [#954] Valentina produces empty rotation operation. - [#955] Valentina corrupts file. +- [#956] Setting pattern unit doesn't change combobox value in Tape app. # Version 0.6.1 October 23, 2018 - [#885] Regression. Broken support for multi size measurements. diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index 8112ed09a..8ff179d05 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -208,6 +208,7 @@ void TMainWindow::SetBaseMSize(int size) void TMainWindow::SetPUnit(Unit unit) { pUnit = unit; + SetCurrentPatternUnit(); UpdatePatternUnit(); } @@ -1933,14 +1934,6 @@ void TMainWindow::SaveMFullName() } } -//--------------------------------------------------------------------------------------------------------------------- -void TMainWindow::PatternUnitChanged(int index) -{ - pUnit = static_cast(comboBoxUnits->itemData(index).toInt()); - - UpdatePatternUnit(); -} - //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::SetupMenu() { @@ -3363,6 +3356,21 @@ void TMainWindow::ImportMultisizeMeasurements(const QxtCsvModel &csv) RefreshDataAfterImport(); } +//--------------------------------------------------------------------------------------------------------------------- +void TMainWindow::SetCurrentPatternUnit() +{ + if (comboBoxUnits) + { + comboBoxUnits->blockSignals(true); + const qint32 indexUnit = comboBoxUnits->findData(static_cast(pUnit)); + if (indexUnit != -1) + { + comboBoxUnits->setCurrentIndex(indexUnit); + } + comboBoxUnits->blockSignals(false); + } +} + //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::SetDecimals() { @@ -3411,15 +3419,14 @@ void TMainWindow::InitUnits() comboBoxUnits = new QComboBox(this); InitComboBoxUnits(); + SetCurrentPatternUnit(); - // set default unit - const qint32 indexUnit = comboBoxUnits->findData(static_cast(pUnit)); - if (indexUnit != -1) + connect(comboBoxUnits, QOverload::of(&QComboBox::currentIndexChanged), this, [this](int index) { - comboBoxUnits->setCurrentIndex(indexUnit); - } + pUnit = static_cast(comboBoxUnits->itemData(index).toInt()); - connect(comboBoxUnits, QOverload::of(&QComboBox::currentIndexChanged), this, &TMainWindow::PatternUnitChanged); + UpdatePatternUnit(); + }); ui->toolBarGradation->addWidget(comboBoxUnits); } diff --git a/src/app/tape/tmainwindow.h b/src/app/tape/tmainwindow.h index cd6353a93..d3dbf64ee 100644 --- a/src/app/tape/tmainwindow.h +++ b/src/app/tape/tmainwindow.h @@ -127,8 +127,6 @@ private slots: void SaveMDescription(); void SaveMFullName(); - void PatternUnitChanged(int index); - private: Q_DISABLE_COPY(TMainWindow) Ui::TMainWindow *ui; @@ -222,6 +220,8 @@ private: void ImportIndividualMeasurements(const QxtCsvModel &csv); void ImportMultisizeMeasurements(const QxtCsvModel &csv); + + void SetCurrentPatternUnit(); }; #endif // TMAINWINDOW_H