@@ -5,6 +5,7 | |||
|
5 | 5 | |
|
6 | 6 | #include <Data/ArrayData.h> |
|
7 | 7 | #include <Data/IDataSeries.h> |
|
8 | #include <Settings/SqpSettingsDefs.h> | |
|
8 | 9 | #include <SqpApplication.h> |
|
9 | 10 | #include <Variable/Variable.h> |
|
10 | 11 | #include <Variable/VariableController.h> |
@@ -21,6 +22,13 const auto HORIZONTAL_ZOOM_MODIFIER = Qt::NoModifier; | |||
|
21 | 22 | /// Key pressed to enable zoom on vertical axis |
|
22 | 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 | 32 | } // namespace |
|
25 | 33 | |
|
26 | 34 | struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate { |
@@ -106,8 +114,10 void VisualizationGraphWidget::addVariableUsingGraph(std::shared_ptr<Variable> v | |||
|
106 | 114 | |
|
107 | 115 | auto variableDateTimeWithTolerance = dateTime; |
|
108 | 116 | |
|
109 |
// add |
|
|
110 | auto tolerance = 0.2 * (dateTime.m_TEnd - dateTime.m_TStart); | |
|
117 | // add tolerance for each side | |
|
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 | 121 | variableDateTimeWithTolerance.m_TStart -= tolerance; |
|
112 | 122 | variableDateTimeWithTolerance.m_TEnd += tolerance; |
|
113 | 123 | |
@@ -220,8 +230,8 void VisualizationGraphWidget::onGraphMenuRequested(const QPoint &pos) noexcept | |||
|
220 | 230 | |
|
221 | 231 | void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1, const QCPRange &t2) |
|
222 | 232 | { |
|
223 |
qCInfo(LOG_VisualizationGraphWidget()) |
|
|
224 | << QThread::currentThread()->objectName(); | |
|
233 | qCInfo(LOG_VisualizationGraphWidget()) | |
|
234 | << tr("VisualizationGraphWidget::onRangeChanged") << QThread::currentThread()->objectName(); | |
|
225 | 235 | |
|
226 | 236 | auto dateTimeRange = SqpDateTime{t1.lower, t1.upper}; |
|
227 | 237 | |
@@ -232,7 +242,8 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1, const QCPRange | |||
|
232 | 242 | auto variable = it->first; |
|
233 | 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 | 247 | auto tolerance = toleranceFactor * (currentDateTime.m_TEnd - currentDateTime.m_TStart); |
|
237 | 248 | auto variableDateTimeWithTolerance = currentDateTime; |
|
238 | 249 | variableDateTimeWithTolerance.m_TStart -= tolerance; |
General Comments 0
You need to be logged in to leave comments.
Login now