@@ -12,6 +12,7 | |||||
12 |
|
12 | |||
13 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationGraphWidget) |
|
13 | Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationGraphWidget) | |
14 |
|
14 | |||
|
15 | class QCPRange; | |||
15 | class Variable; |
|
16 | class Variable; | |
16 |
|
17 | |||
17 | namespace Ui { |
|
18 | namespace Ui { | |
@@ -40,6 +41,9 private: | |||||
40 | spimpl::unique_impl_ptr<VisualizationGraphWidgetPrivate> impl; |
|
41 | spimpl::unique_impl_ptr<VisualizationGraphWidgetPrivate> impl; | |
41 |
|
42 | |||
42 | private slots: |
|
43 | private slots: | |
|
44 | ||||
|
45 | void onRangeChanged(const QCPRange &t1, const QCPRange &t2); | |||
|
46 | ||||
43 | /// Slot called when a mouse wheel was made, to perform some processing before the zoom is done |
|
47 | /// Slot called when a mouse wheel was made, to perform some processing before the zoom is done | |
44 | void onMouseWheel(QWheelEvent *event) noexcept; |
|
48 | void onMouseWheel(QWheelEvent *event) noexcept; | |
45 | }; |
|
49 | }; |
@@ -4,7 +4,6 | |||||
4 | #include "ui_VisualizationGraphWidget.h" |
|
4 | #include "ui_VisualizationGraphWidget.h" | |
5 |
|
5 | |||
6 | #include <Variable/Variable.h> |
|
6 | #include <Variable/Variable.h> | |
7 |
|
||||
8 | #include <unordered_map> |
|
7 | #include <unordered_map> | |
9 |
|
8 | |||
10 | Q_LOGGING_CATEGORY(LOG_VisualizationGraphWidget, "VisualizationGraphWidget") |
|
9 | Q_LOGGING_CATEGORY(LOG_VisualizationGraphWidget, "VisualizationGraphWidget") | |
@@ -42,8 +41,12 VisualizationGraphWidget::VisualizationGraphWidget(const QString &name, QWidget | |||||
42 | ui->widget->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom); |
|
41 | ui->widget->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom); | |
43 | ui->widget->axisRect()->setRangeDrag(Qt::Horizontal); |
|
42 | ui->widget->axisRect()->setRangeDrag(Qt::Horizontal); | |
44 | connect(ui->widget, &QCustomPlot::mouseWheel, this, &VisualizationGraphWidget::onMouseWheel); |
|
43 | connect(ui->widget, &QCustomPlot::mouseWheel, this, &VisualizationGraphWidget::onMouseWheel); | |
|
44 | connect(ui->widget->xAxis, static_cast<void (QCPAxis::*)(const QCPRange &, const QCPRange &)>( | |||
|
45 | &QCPAxis::rangeChanged), | |||
|
46 | this, &VisualizationGraphWidget::onRangeChanged); | |||
45 | } |
|
47 | } | |
46 |
|
48 | |||
|
49 | ||||
47 | VisualizationGraphWidget::~VisualizationGraphWidget() |
|
50 | VisualizationGraphWidget::~VisualizationGraphWidget() | |
48 | { |
|
51 | { | |
49 | delete ui; |
|
52 | delete ui; | |
@@ -93,6 +96,14 QString VisualizationGraphWidget::name() const | |||||
93 | } |
|
96 | } | |
94 | } |
|
97 | } | |
95 |
|
98 | |||
|
99 | void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1, const QCPRange &t2) | |||
|
100 | { | |||
|
101 | for (auto it = impl->m_VariableToPlotMap.cbegin(); it != impl->m_VariableToPlotMap.cend(); | |||
|
102 | ++it) { | |||
|
103 | it->first->onXRangeChanged(SqpDateTime{t2.lower, t2.upper}); | |||
|
104 | } | |||
|
105 | } | |||
|
106 | ||||
96 | void VisualizationGraphWidget::onMouseWheel(QWheelEvent *event) noexcept |
|
107 | void VisualizationGraphWidget::onMouseWheel(QWheelEvent *event) noexcept | |
97 | { |
|
108 | { | |
98 | auto zoomOrientations = QFlags<Qt::Orientation>{}; |
|
109 | auto zoomOrientations = QFlags<Qt::Orientation>{}; |
General Comments 0
You need to be logged in to leave comments.
Login now