Added option to select minimum fractional inch displayed
Load/save operation complete. Not yet integrated with the display code. Also would like to disable option when non supported (those not using fractional inches) are selected.
This commit is contained in:
@@ -20,6 +20,40 @@
|
||||
<string>Units settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="4" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>79</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Number of decimals:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBoxDecimals">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>12</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
@@ -70,28 +104,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Number of decimals:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBoxDecimals">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>12</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QTableWidget" name="tableWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||
@@ -114,18 +127,58 @@
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>79</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<item row="2" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Minimum fractional inch:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_FracInch">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Minimum fractional inch to display.</p></body></html></string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1/2"</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1/4"</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1/8"</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1/16"</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1/32"</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1/64"</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1/128"</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
@@ -80,7 +80,16 @@ void DlgSettingsUnitsImp::saveSettings()
|
||||
("User parameter:BaseApp/Preferences/Units");
|
||||
hGrp->SetInt("UserSchema", ui->comboBox_ViewSystem->currentIndex());
|
||||
hGrp->SetInt("Decimals", ui->spinBoxDecimals->value());
|
||||
hGrp->SetInt("FracInchIndex", ui->comboBox_FracInch->currentIndex());
|
||||
|
||||
// Set actual value
|
||||
Base::UnitsApi::setDecimals(ui->spinBoxDecimals->value());
|
||||
|
||||
// Convert the combobox index to the its integer denominator. Currently
|
||||
// with 1/2, 1/4, through 1/128, this little equation directly computes the
|
||||
// denominator given the combobox integer.
|
||||
int minFracInch = std::pow(2, ui->comboBox_FracInch->currentIndex() + 1);
|
||||
hGrp->SetInt("minFracInch", minFracInch);
|
||||
}
|
||||
|
||||
void DlgSettingsUnitsImp::loadSettings()
|
||||
@@ -89,6 +98,7 @@ void DlgSettingsUnitsImp::loadSettings()
|
||||
("User parameter:BaseApp/Preferences/Units");
|
||||
ui->comboBox_ViewSystem->setCurrentIndex(hGrp->GetInt("UserSchema",0));
|
||||
ui->spinBoxDecimals->setValue(hGrp->GetInt("Decimals",Base::UnitsApi::getDecimals()));
|
||||
ui->comboBox_FracInch->setCurrentIndex(hGrp->GetInt("FracInchIndex",2)); // 2==1/8"
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user