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. - [#942] Save Layout mode ignores paper format for tiled PDF.
- [#954] Valentina produces empty rotation operation. - [#954] Valentina produces empty rotation operation.
- [#955] Valentina corrupts file. - [#955] Valentina corrupts file.
- [#956] Setting pattern unit doesn't change combobox value in Tape app.
# Version 0.6.1 October 23, 2018 # Version 0.6.1 October 23, 2018
- [#885] Regression. Broken support for multi size measurements. - [#885] Regression. Broken support for multi size measurements.

View File

@ -208,6 +208,7 @@ void TMainWindow::SetBaseMSize(int size)
void TMainWindow::SetPUnit(Unit unit) void TMainWindow::SetPUnit(Unit unit)
{ {
pUnit = unit; pUnit = unit;
SetCurrentPatternUnit();
UpdatePatternUnit(); 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() void TMainWindow::SetupMenu()
{ {
@ -3363,6 +3356,21 @@ void TMainWindow::ImportMultisizeMeasurements(const QxtCsvModel &csv)
RefreshDataAfterImport(); 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() void TMainWindow::SetDecimals()
{ {
@ -3411,15 +3419,14 @@ void TMainWindow::InitUnits()
comboBoxUnits = new QComboBox(this); comboBoxUnits = new QComboBox(this);
InitComboBoxUnits(); InitComboBoxUnits();
SetCurrentPatternUnit();
// set default unit connect(comboBoxUnits, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this](int index)
const qint32 indexUnit = comboBoxUnits->findData(static_cast<int>(pUnit));
if (indexUnit != -1)
{ {
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); ui->toolBarGradation->addWidget(comboBoxUnits);
} }

View File

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