@@ -10,6 +10,8 class VisualizationGraphRenderingDelegate { | |||||
10 | public: |
|
10 | public: | |
11 | explicit VisualizationGraphRenderingDelegate(QCustomPlot &plot); |
|
11 | explicit VisualizationGraphRenderingDelegate(QCustomPlot &plot); | |
12 |
|
12 | |||
|
13 | void onMouseMove(QMouseEvent *event) noexcept; | |||
|
14 | ||||
13 | private: |
|
15 | private: | |
14 | class VisualizationGraphRenderingDelegatePrivate; |
|
16 | class VisualizationGraphRenderingDelegatePrivate; | |
15 | spimpl::unique_impl_ptr<VisualizationGraphRenderingDelegatePrivate> impl; |
|
17 | spimpl::unique_impl_ptr<VisualizationGraphRenderingDelegatePrivate> impl; |
@@ -69,6 +69,8 private slots: | |||||
69 | /// Rescale the X axe to range parameter |
|
69 | /// Rescale the X axe to range parameter | |
70 | void onRangeChanged(const QCPRange &t1, const QCPRange &t2); |
|
70 | void onRangeChanged(const QCPRange &t1, const QCPRange &t2); | |
71 |
|
71 | |||
|
72 | /// Slot called when a mouse move was made | |||
|
73 | void onMouseMove(QMouseEvent *event) noexcept; | |||
72 | /// Slot called when a mouse wheel was made, to perform some processing before the zoom is done |
|
74 | /// Slot called when a mouse wheel was made, to perform some processing before the zoom is done | |
73 | void onMouseWheel(QWheelEvent *event) noexcept; |
|
75 | void onMouseWheel(QWheelEvent *event) noexcept; | |
74 | /// Slot called when a mouse press was made, to activate the calibration of a graph |
|
76 | /// Slot called when a mouse press was made, to activate the calibration of a graph |
@@ -11,3 +11,7 VisualizationGraphRenderingDelegate::VisualizationGraphRenderingDelegate(QCustom | |||||
11 | : impl{spimpl::make_unique_impl<VisualizationGraphRenderingDelegatePrivate>(plot)} |
|
11 | : impl{spimpl::make_unique_impl<VisualizationGraphRenderingDelegatePrivate>(plot)} | |
12 | { |
|
12 | { | |
13 | } |
|
13 | } | |
|
14 | ||||
|
15 | void VisualizationGraphRenderingDelegate::onMouseMove(QMouseEvent *event) noexcept | |||
|
16 | { | |||
|
17 | } |
@@ -73,9 +73,11 VisualizationGraphWidget::VisualizationGraphWidget(const QString &name, QWidget | |||||
73 | // - Mouse wheel on qcpplot is intercepted to determine the zoom orientation |
|
73 | // - Mouse wheel on qcpplot is intercepted to determine the zoom orientation | |
74 | ui->widget->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom); |
|
74 | ui->widget->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom); | |
75 | ui->widget->axisRect()->setRangeDrag(Qt::Horizontal); |
|
75 | ui->widget->axisRect()->setRangeDrag(Qt::Horizontal); | |
|
76 | ||||
76 | connect(ui->widget, &QCustomPlot::mousePress, this, &VisualizationGraphWidget::onMousePress); |
|
77 | connect(ui->widget, &QCustomPlot::mousePress, this, &VisualizationGraphWidget::onMousePress); | |
77 | connect(ui->widget, &QCustomPlot::mouseRelease, this, |
|
78 | connect(ui->widget, &QCustomPlot::mouseRelease, this, | |
78 | &VisualizationGraphWidget::onMouseRelease); |
|
79 | &VisualizationGraphWidget::onMouseRelease); | |
|
80 | connect(ui->widget, &QCustomPlot::mouseMove, this, &VisualizationGraphWidget::onMouseMove); | |||
79 | connect(ui->widget, &QCustomPlot::mouseWheel, this, &VisualizationGraphWidget::onMouseWheel); |
|
81 | connect(ui->widget, &QCustomPlot::mouseWheel, this, &VisualizationGraphWidget::onMouseWheel); | |
80 | connect(ui->widget->xAxis, static_cast<void (QCPAxis::*)(const QCPRange &, const QCPRange &)>( |
|
82 | connect(ui->widget->xAxis, static_cast<void (QCPAxis::*)(const QCPRange &, const QCPRange &)>( | |
81 | &QCPAxis::rangeChanged), |
|
83 | &QCPAxis::rangeChanged), | |
@@ -337,6 +339,12 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1, const QCPRange | |||||
337 | } |
|
339 | } | |
338 | } |
|
340 | } | |
339 |
|
341 | |||
|
342 | void VisualizationGraphWidget::onMouseMove(QMouseEvent *event) noexcept | |||
|
343 | { | |||
|
344 | // Handles plot rendering when mouse is moving | |||
|
345 | impl->m_RenderingDelegate->onMouseMove(event); | |||
|
346 | } | |||
|
347 | ||||
340 | void VisualizationGraphWidget::onMouseWheel(QWheelEvent *event) noexcept |
|
348 | void VisualizationGraphWidget::onMouseWheel(QWheelEvent *event) noexcept | |
341 | { |
|
349 | { | |
342 | auto zoomOrientations = QFlags<Qt::Orientation>{}; |
|
350 | auto zoomOrientations = QFlags<Qt::Orientation>{}; |
General Comments 0
You need to be logged in to leave comments.
Login now