Fixed issue #956. Setting pattern unit doesn't change combobox value in Tape

app.
(grafted from 591df5032a71d33d0f17242bebc2d128f9e27d99)

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-03-14 11:53:08 +02:00
parent 5008c2c248
commit 2c8539a30d
3 changed files with 24 additions and 16 deletions

View File

@ -30,6 +30,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.

View File

@ -202,6 +202,7 @@ void TMainWindow::SetBaseMSize(int size)
void TMainWindow::SetPUnit(Unit unit)
{
pUnit = unit;
SetCurrentPatternUnit();
UpdatePatternUnit();
}
@ -1895,14 +1896,6 @@ void TMainWindow::SaveMFullName()
}
}
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::PatternUnitChanged(int index)
{
pUnit = static_cast<Unit>(comboBoxUnits->itemData(index).toInt());
UpdatePatternUnit();
}
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::SetupMenu()
{
@ -3301,6 +3294,21 @@ void TMainWindow::ImportMultisizeMeasurements(const QxtCsvModel &csv)
RefreshDataAfterImport();
}
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::SetCurrentPatternUnit()
{
if (comboBoxUnits)
{
comboBoxUnits->blockSignals(true);
const qint32 indexUnit = comboBoxUnits->findData(static_cast<int>(pUnit));
if (indexUnit != -1)
{
comboBoxUnits->setCurrentIndex(indexUnit);
}
comboBoxUnits->blockSignals(false);
}
}
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::SetDecimals()
{
@ -3349,15 +3357,14 @@ void TMainWindow::InitUnits()
comboBoxUnits = new QComboBox(this);
InitComboBoxUnits();
SetCurrentPatternUnit();
// set default unit
const qint32 indexUnit = comboBoxUnits->findData(static_cast<int>(pUnit));
if (indexUnit != -1)
connect(comboBoxUnits, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this](int index)
{
comboBoxUnits->setCurrentIndex(indexUnit);
}
pUnit = static_cast<Unit>(comboBoxUnits->itemData(index).toInt());
connect(comboBoxUnits, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &TMainWindow::PatternUnitChanged);
UpdatePatternUnit();
});
ui->toolBarGradation->addWidget(comboBoxUnits);
}

View File

@ -126,8 +126,6 @@ private slots:
void SaveMDescription();
void SaveMFullName();
void PatternUnitChanged(int index);
private:
Q_DISABLE_COPY(TMainWindow)
Ui::TMainWindow *ui;
@ -219,6 +217,8 @@ private:
void ImportIndividualMeasurements(const QxtCsvModel &csv);
void ImportMultisizeMeasurements(const QxtCsvModel &csv);
void SetCurrentPatternUnit();
};
#endif // TMAINWINDOW_H