@@ -5,6 +5,7 | |||||
5 |
|
5 | |||
6 | #include <Data/ArrayData.h> |
|
6 | #include <Data/ArrayData.h> | |
7 | #include <Data/IDataSeries.h> |
|
7 | #include <Data/IDataSeries.h> | |
|
8 | #include <Settings/SqpSettingsDefs.h> | |||
8 | #include <SqpApplication.h> |
|
9 | #include <SqpApplication.h> | |
9 | #include <Variable/Variable.h> |
|
10 | #include <Variable/Variable.h> | |
10 | #include <Variable/VariableController.h> |
|
11 | #include <Variable/VariableController.h> | |
@@ -21,6 +22,13 const auto HORIZONTAL_ZOOM_MODIFIER = Qt::NoModifier; | |||||
21 | /// Key pressed to enable zoom on vertical axis |
|
22 | /// Key pressed to enable zoom on vertical axis | |
22 | const auto VERTICAL_ZOOM_MODIFIER = Qt::ControlModifier; |
|
23 | const auto VERTICAL_ZOOM_MODIFIER = Qt::ControlModifier; | |
23 |
|
24 | |||
|
25 | /// Gets a tolerance value from application settings. If the setting can't be found, the default | |||
|
26 | /// value passed in parameter is returned | |||
|
27 | double toleranceValue(const QString &key, double defaultValue) noexcept | |||
|
28 | { | |||
|
29 | return QSettings{}.value(key, defaultValue).toDouble(); | |||
|
30 | } | |||
|
31 | ||||
24 | } // namespace |
|
32 | } // namespace | |
25 |
|
33 | |||
26 | struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate { |
|
34 | struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate { | |
@@ -106,8 +114,10 void VisualizationGraphWidget::addVariableUsingGraph(std::shared_ptr<Variable> v | |||||
106 |
|
114 | |||
107 | auto variableDateTimeWithTolerance = dateTime; |
|
115 | auto variableDateTimeWithTolerance = dateTime; | |
108 |
|
116 | |||
109 |
// add |
|
117 | // add tolerance for each side | |
110 | auto tolerance = 0.2 * (dateTime.m_TEnd - dateTime.m_TStart); |
|
118 | auto toleranceFactor | |
|
119 | = toleranceValue(GENERAL_TOLERANCE_AT_INIT_KEY, GENERAL_TOLERANCE_AT_INIT_DEFAULT_VALUE); | |||
|
120 | auto tolerance = toleranceFactor * (dateTime.m_TEnd - dateTime.m_TStart); | |||
111 | variableDateTimeWithTolerance.m_TStart -= tolerance; |
|
121 | variableDateTimeWithTolerance.m_TStart -= tolerance; | |
112 | variableDateTimeWithTolerance.m_TEnd += tolerance; |
|
122 | variableDateTimeWithTolerance.m_TEnd += tolerance; | |
113 |
|
123 | |||
@@ -220,8 +230,8 void VisualizationGraphWidget::onGraphMenuRequested(const QPoint &pos) noexcept | |||||
220 |
|
230 | |||
221 | void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1, const QCPRange &t2) |
|
231 | void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1, const QCPRange &t2) | |
222 | { |
|
232 | { | |
223 |
qCInfo(LOG_VisualizationGraphWidget()) |
|
233 | qCInfo(LOG_VisualizationGraphWidget()) | |
224 | << QThread::currentThread()->objectName(); |
|
234 | << tr("VisualizationGraphWidget::onRangeChanged") << QThread::currentThread()->objectName(); | |
225 |
|
235 | |||
226 | auto dateTimeRange = SqpDateTime{t1.lower, t1.upper}; |
|
236 | auto dateTimeRange = SqpDateTime{t1.lower, t1.upper}; | |
227 |
|
237 | |||
@@ -232,7 +242,8 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1, const QCPRange | |||||
232 | auto variable = it->first; |
|
242 | auto variable = it->first; | |
233 | auto currentDateTime = dateTimeRange; |
|
243 | auto currentDateTime = dateTimeRange; | |
234 |
|
244 | |||
235 | auto toleranceFactor = 0.2; |
|
245 | auto toleranceFactor = toleranceValue(GENERAL_TOLERANCE_AT_UPDATE_KEY, | |
|
246 | GENERAL_TOLERANCE_AT_UPDATE_DEFAULT_VALUE); | |||
236 | auto tolerance = toleranceFactor * (currentDateTime.m_TEnd - currentDateTime.m_TStart); |
|
247 | auto tolerance = toleranceFactor * (currentDateTime.m_TEnd - currentDateTime.m_TStart); | |
237 | auto variableDateTimeWithTolerance = currentDateTime; |
|
248 | auto variableDateTimeWithTolerance = currentDateTime; | |
238 | variableDateTimeWithTolerance.m_TStart -= tolerance; |
|
249 | variableDateTimeWithTolerance.m_TStart -= tolerance; |
General Comments 0
You need to be logged in to leave comments.
Login now