allow to choose a custom units schema in calculator
This commit is contained in:
@@ -119,48 +119,7 @@ To add a calculation press Return in the value input field</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QComboBox" name="comboBoxScheme">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Standard (mm/kg/s/degree)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>MKS (m/kg/s/degree)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>US customary (in/lb)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Imperial decimal (in/lb)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Building Euro (cm/m²/m³)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Building US (ft-in/sqft/cuft)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Metric small parts & CNC(mm, mm/min)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Imperial Civil (ft/ft^2/ft^3)</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBoxScheme"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
|
||||
@@ -50,6 +50,13 @@ DlgUnitsCalculator::DlgUnitsCalculator( QWidget* parent, Qt::WindowFlags fl )
|
||||
ui->setupUi(this);
|
||||
this->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
ui->comboBoxScheme->addItem(QString::fromLatin1("System schema"), static_cast<int>(-1));
|
||||
int num = static_cast<int>(Base::UnitSystem::NumUnitSystemTypes);
|
||||
for (int i=0; i<num; i++) {
|
||||
QString item = QString::fromLatin1(Base::UnitsApi::getDescription(static_cast<Base::UnitSystem>(i)));
|
||||
ui->comboBoxScheme->addItem(item, i);
|
||||
}
|
||||
|
||||
connect(ui->ValueInput, SIGNAL(valueChanged(Base::Quantity)), this, SLOT(valueChanged(Base::Quantity)));
|
||||
connect(ui->ValueInput, SIGNAL(returnPressed()), this, SLOT(returnPressed()));
|
||||
connect(ui->UnitInput, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString)));
|
||||
@@ -102,9 +109,6 @@ DlgUnitsCalculator::DlgUnitsCalculator( QWidget* parent, Qt::WindowFlags fl )
|
||||
ui->quantitySpinBox->setValue(1.0);
|
||||
ui->quantitySpinBox->setUnit(units.front());
|
||||
ui->spinBoxDecimals->setValue(Base::UnitsApi::getDecimals());
|
||||
|
||||
// see on_comboBoxScheme_activated
|
||||
ui->comboBoxScheme->setDisabled(true);
|
||||
}
|
||||
|
||||
/** Destroys the object and frees any allocated resources */
|
||||
@@ -200,8 +204,11 @@ void DlgUnitsCalculator::on_unitsBox_activated(int index)
|
||||
|
||||
void DlgUnitsCalculator::on_comboBoxScheme_activated(int index)
|
||||
{
|
||||
//TODO
|
||||
Q_UNUSED(index)
|
||||
int item = ui->comboBoxScheme->itemData(index).toInt();
|
||||
if (item > 0)
|
||||
ui->quantitySpinBox->setSchema(static_cast<Base::UnitSystem>(item));
|
||||
else
|
||||
ui->quantitySpinBox->clearSchema();
|
||||
}
|
||||
|
||||
void DlgUnitsCalculator::on_spinBoxDecimals_valueChanged(int value)
|
||||
|
||||
Reference in New Issue
Block a user