Show default unit in dialog individual measurements.

--HG--
branch : develop
This commit is contained in:
dismine 2014-07-09 15:35:52 +03:00
parent f8d304e7fc
commit 6f127035f4
2 changed files with 15 additions and 3 deletions

View File

@ -92,7 +92,7 @@ void ConfigurationPage::Apply()
QString unit = qvariant_cast<QString>(this->unitCombo->itemData(this->unitCombo->currentIndex())); QString unit = qvariant_cast<QString>(this->unitCombo->itemData(this->unitCombo->currentIndex()));
settings.setValue("configuration/unit", unit); settings.setValue("configuration/unit", unit);
this->unitChanged = false; this->unitChanged = false;
QString text = QString(tr("Default unit updated and will be used the next pattern load")); QString text = QString(tr("Default unit updated and will be used the next pattern creation"));
QMessageBox::information(this, QApplication::applicationName(), text); QMessageBox::information(this, QApplication::applicationName(), text);
} }
} }

View File

@ -248,6 +248,18 @@ void DialogIndividualMeasurements::NewTable()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogIndividualMeasurements::InitUnits() void DialogIndividualMeasurements::InitUnits()
{ {
ui->comboBoxUnits->addItem(tr("centimeter"), QVariant(VDomDocument::UnitsToStr(Unit::Cm))); QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
ui->comboBoxUnits->addItem(tr("inch"), QVariant(VDomDocument::UnitsToStr(Unit::Inch))); QApplication::applicationName());
ui->comboBoxUnits->addItem(tr("Centimeters"), QVariant(VDomDocument::UnitsToStr(Unit::Cm)));
ui->comboBoxUnits->addItem(tr("Milimiters"), QVariant(VDomDocument::UnitsToStr(Unit::Mm)));
ui->comboBoxUnits->addItem(tr("Inches"), QVariant(VDomDocument::UnitsToStr(Unit::Inch, true)));
const QString checkedUnit = settings.value("configuration/unit", "cm").toString();
// set default unit
const qint32 indexUnit = ui->comboBoxUnits->findData(checkedUnit);
if (indexUnit != -1)
{
ui->comboBoxUnits->setCurrentIndex(indexUnit);
}
} }