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

app.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2019-03-14 11:53:08 +02:00
parent 7cf25f1925
commit ca567ce981
3 changed files with 24 additions and 16 deletions

View File

@ -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.

View File

@ -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<Unit>(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<int>(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<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

@ -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