##// END OF EJS Templates
Removes max limit on tolerance settings
Alexandre Leroux -
r613:c1e80b6034b1
parent child
Show More
@@ -1,45 +1,51
1 1 #include "Settings/SqpSettingsGeneralWidget.h"
2 2
3 3 #include "Settings/SqpSettingsDefs.h"
4 4
5 5 #include "ui_SqpSettingsGeneralWidget.h"
6 6
7 7 SqpSettingsGeneralWidget::SqpSettingsGeneralWidget(QWidget *parent)
8 8 : QWidget{parent}, ui{new Ui::SqpSettingsGeneralWidget}
9 9 {
10 10 ui->setupUi(this);
11
12 // Value limits
13 ui->toleranceInitSpinBox->setMinimum(0.);
14 ui->toleranceInitSpinBox->setMaximum(std::numeric_limits<double>::max());
15 ui->toleranceUpdateSpinBox->setMinimum(0.);
16 ui->toleranceUpdateSpinBox->setMaximum(std::numeric_limits<double>::max());
11 17 }
12 18
13 19 SqpSettingsGeneralWidget::~SqpSettingsGeneralWidget() noexcept
14 20 {
15 21 delete ui;
16 22 }
17 23
18 24 void SqpSettingsGeneralWidget::loadSettings()
19 25 {
20 26 QSettings settings{};
21 27
22 28 auto loadTolerance = [&settings](const QString &key, double defaultValue) {
23 29 // Tolerance is converted to percent
24 30 auto toleranceValue = settings.value(key, defaultValue).toDouble();
25 31 return toleranceValue * 100.;
26 32 };
27 33
28 34 ui->toleranceInitSpinBox->setValue(
29 35 loadTolerance(GENERAL_TOLERANCE_AT_INIT_KEY, GENERAL_TOLERANCE_AT_INIT_DEFAULT_VALUE));
30 36 ui->toleranceUpdateSpinBox->setValue(
31 37 loadTolerance(GENERAL_TOLERANCE_AT_UPDATE_KEY, GENERAL_TOLERANCE_AT_UPDATE_DEFAULT_VALUE));
32 38 }
33 39
34 40 void SqpSettingsGeneralWidget::saveSettings() const
35 41 {
36 42 QSettings settings{};
37 43
38 44 auto saveTolerance = [&settings](const QString &key, double value) {
39 45 // Tolerance is converted from percent
40 46 settings.setValue(key, value * 0.01);
41 47 };
42 48
43 49 saveTolerance(GENERAL_TOLERANCE_AT_INIT_KEY, ui->toleranceInitSpinBox->value());
44 50 saveTolerance(GENERAL_TOLERANCE_AT_UPDATE_KEY, ui->toleranceUpdateSpinBox->value());
45 51 }
@@ -1,86 +1,74
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <ui version="4.0">
3 3 <class>SqpSettingsGeneralWidget</class>
4 4 <widget class="QWidget" name="SqpSettingsGeneralWidget">
5 5 <property name="geometry">
6 6 <rect>
7 7 <x>0</x>
8 8 <y>0</y>
9 9 <width>343</width>
10 10 <height>300</height>
11 11 </rect>
12 12 </property>
13 13 <property name="windowTitle">
14 14 <string>Form</string>
15 15 </property>
16 16 <layout class="QGridLayout" name="gridLayout">
17 17 <item row="0" column="0">
18 18 <widget class="QLabel" name="toleranceInitLabel">
19 19 <property name="text">
20 20 <string>Tolerance on first acquisition:</string>
21 21 </property>
22 22 </widget>
23 23 </item>
24 24 <item row="0" column="1">
25 25 <widget class="QDoubleSpinBox" name="toleranceInitSpinBox">
26 26 <property name="sizePolicy">
27 27 <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
28 28 <horstretch>0</horstretch>
29 29 <verstretch>0</verstretch>
30 30 </sizepolicy>
31 31 </property>
32 32 <property name="suffix">
33 33 <string> %</string>
34 34 </property>
35 <property name="minimum">
36 <double>0.000000000000000</double>
37 </property>
38 <property name="maximum">
39 <double>500.000000000000000</double>
40 </property>
41 35 </widget>
42 36 </item>
43 37 <item row="1" column="0">
44 38 <widget class="QLabel" name="toleranceUpdateLabel">
45 39 <property name="text">
46 40 <string>Tolerance when updating acquisition:</string>
47 41 </property>
48 42 </widget>
49 43 </item>
50 44 <item row="1" column="1">
51 45 <widget class="QDoubleSpinBox" name="toleranceUpdateSpinBox">
52 46 <property name="sizePolicy">
53 47 <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
54 48 <horstretch>0</horstretch>
55 49 <verstretch>0</verstretch>
56 50 </sizepolicy>
57 51 </property>
58 52 <property name="suffix">
59 53 <string> %</string>
60 54 </property>
61 <property name="minimum">
62 <double>0.000000000000000</double>
63 </property>
64 <property name="maximum">
65 <double>500.000000000000000</double>
66 </property>
67 55 </widget>
68 56 </item>
69 57 <item row="2" column="0">
70 58 <spacer name="verticalSpacer">
71 59 <property name="orientation">
72 60 <enum>Qt::Vertical</enum>
73 61 </property>
74 62 <property name="sizeHint" stdset="0">
75 63 <size>
76 64 <width>20</width>
77 65 <height>40</height>
78 66 </size>
79 67 </property>
80 68 </spacer>
81 69 </item>
82 70 </layout>
83 71 </widget>
84 72 <resources/>
85 73 <connections/>
86 74 </ui>
General Comments 0
You need to be logged in to leave comments. Login now