extend units calculator
This commit is contained in:
@@ -6,14 +6,14 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>425</width>
|
||||
<height>187</height>
|
||||
<width>645</width>
|
||||
<height>375</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Units calculator</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
@@ -89,42 +89,118 @@ To add a calculation press Return in the value input field</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Quantity:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::QuantitySpinBox" name="quantitySpinBox" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Units:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="unitsBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Quantity</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Quantity:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::QuantitySpinBox" name="quantitySpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Scheme:</string>
|
||||
</property>
|
||||
</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>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Decimals:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxDecimals">
|
||||
<property name="minimum">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>5</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Units:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QComboBox" name="unitsBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
|
||||
@@ -66,22 +66,45 @@ DlgUnitsCalculator::DlgUnitsCalculator( QWidget* parent, Qt::WindowFlags fl )
|
||||
ui->ValueInput->setText(QString::fromLatin1("1 cm"));
|
||||
ui->UnitInput->setText(QString::fromLatin1("in"));
|
||||
|
||||
units << Base::Unit::Acceleration << Base::Unit::AmountOfSubstance << Base::Unit::Angle
|
||||
<< Base::Unit::Area << Base::Unit::Density << Base::Unit::ElectricalCapacitance
|
||||
<< Base::Unit::ElectricalInductance << Base::Unit::ElectricCharge
|
||||
<< Base::Unit::ElectricCurrent << Base::Unit::ElectricPotential
|
||||
<< Base::Unit::Frequency << Base::Unit::Force << Base::Unit::HeatFlux << Base::Unit::Length
|
||||
<< Base::Unit::LuminousIntensity << Base::Unit::Mass << Base::Unit::MagneticFluxDensity
|
||||
<< Base::Unit::Pressure << Base::Unit::Power << Base::Unit::SpecificHeat
|
||||
<< Base::Unit::Stress << Base::Unit::Temperature << Base::Unit::ThermalConductivity
|
||||
<< Base::Unit::ThermalExpansionCoefficient << Base::Unit::ThermalTransferCoefficient
|
||||
<< Base::Unit::TimeSpan << Base::Unit::Velocity << Base::Unit::Volume << Base::Unit::Work;
|
||||
units << Base::Unit::Acceleration
|
||||
<< Base::Unit::AmountOfSubstance
|
||||
<< Base::Unit::Angle
|
||||
<< Base::Unit::Area
|
||||
<< Base::Unit::Density
|
||||
<< Base::Unit::ElectricalCapacitance
|
||||
<< Base::Unit::ElectricalInductance
|
||||
<< Base::Unit::ElectricCharge
|
||||
<< Base::Unit::ElectricCurrent
|
||||
<< Base::Unit::ElectricPotential
|
||||
<< Base::Unit::Frequency
|
||||
<< Base::Unit::Force
|
||||
<< Base::Unit::HeatFlux
|
||||
<< Base::Unit::Length
|
||||
<< Base::Unit::LuminousIntensity
|
||||
<< Base::Unit::Mass
|
||||
<< Base::Unit::MagneticFluxDensity
|
||||
<< Base::Unit::Pressure
|
||||
<< Base::Unit::Power
|
||||
<< Base::Unit::SpecificHeat
|
||||
<< Base::Unit::Stress
|
||||
<< Base::Unit::Temperature
|
||||
<< Base::Unit::ThermalConductivity
|
||||
<< Base::Unit::ThermalExpansionCoefficient
|
||||
<< Base::Unit::ThermalTransferCoefficient
|
||||
<< Base::Unit::TimeSpan
|
||||
<< Base::Unit::Velocity
|
||||
<< Base::Unit::Volume
|
||||
<< Base::Unit::Work;
|
||||
for (QList<Base::Unit>::iterator it = units.begin(); it != units.end(); ++it) {
|
||||
ui->unitsBox->addItem(it->getTypeString());
|
||||
}
|
||||
|
||||
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 */
|
||||
@@ -164,7 +187,19 @@ void DlgUnitsCalculator::returnPressed(void)
|
||||
|
||||
void DlgUnitsCalculator::on_unitsBox_activated(int index)
|
||||
{
|
||||
ui->quantitySpinBox->setValue(1.0);
|
||||
ui->quantitySpinBox->setUnit(units[index]);
|
||||
}
|
||||
|
||||
void DlgUnitsCalculator::on_comboBoxScheme_activated(int index)
|
||||
{
|
||||
//TODO
|
||||
Q_UNUSED(index)
|
||||
}
|
||||
|
||||
void DlgUnitsCalculator::on_spinBoxDecimals_valueChanged(int value)
|
||||
{
|
||||
ui->quantitySpinBox->setDecimals(value);
|
||||
}
|
||||
|
||||
#include "moc_DlgUnitsCalculatorImp.cpp"
|
||||
|
||||
@@ -53,6 +53,8 @@ protected Q_SLOTS:
|
||||
void textChanged(const QString);
|
||||
void valueChanged(const Base::Quantity&);
|
||||
void on_unitsBox_activated(int);
|
||||
void on_comboBoxScheme_activated(int);
|
||||
void on_spinBoxDecimals_valueChanged(int);
|
||||
|
||||
void copy(void);
|
||||
void returnPressed(void);
|
||||
|
||||
Reference in New Issue
Block a user