Skip to content

Commit 0dbfef7

Browse files
committed
Increase decimals when imperial input is selected
1 parent 832e260 commit 0dbfef7

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

mainwindow.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,13 +519,19 @@ void MainWindow::adjustMetricImperial(QDoubleSpinBox *doubleSpinBox, const doubl
519519

520520
if( changeMetricImperialValues )
521521
{
522+
if (cfactor < 1)
523+
doubleSpinBox->setDecimals(doubleSpinBox->decimals() + 1);
524+
522525
value = doubleSpinBox->value();
523526
maximum = doubleSpinBox->maximum();
524527
minimum = doubleSpinBox->minimum();
525528

526529
doubleSpinBox->setMaximum( maximum * cfactor );
527530
doubleSpinBox->setMinimum( minimum * cfactor );
528531
doubleSpinBox->setValue( value * cfactor );
532+
533+
if (cfactor >= 1)
534+
doubleSpinBox->setDecimals(doubleSpinBox->decimals() - 1);
529535
}
530536

531537
doubleSpinBox->setSuffix(suffix);

mainwindow.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<x>0</x>
88
<y>0</y>
99
<width>850</width>
10-
<height>550</height>
10+
<height>555</height>
1111
</rect>
1212
</property>
1313
<property name="sizePolicy">
@@ -522,7 +522,7 @@
522522
<number>3</number>
523523
</property>
524524
<property name="minimum">
525-
<double>0.001000000000000</double>
525+
<double>0.002000000000000</double>
526526
</property>
527527
<property name="maximum">
528528
<double>10.000000000000000</double>

0 commit comments

Comments
 (0)