##// END OF EJS Templates
Creates method that will display a tooltip and a tracer with data point information after a while
Alexandre Leroux -
r481:0277630b5c10
parent child
Show More
@@ -10,6 +10,8 class VisualizationGraphRenderingDelegate {
10 10 public:
11 11 explicit VisualizationGraphRenderingDelegate(QCustomPlot &plot);
12 12
13 void onMouseMove(QMouseEvent *event) noexcept;
14
13 15 private:
14 16 class VisualizationGraphRenderingDelegatePrivate;
15 17 spimpl::unique_impl_ptr<VisualizationGraphRenderingDelegatePrivate> impl;
@@ -69,6 +69,8 private slots:
69 69 /// Rescale the X axe to range parameter
70 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 74 /// Slot called when a mouse wheel was made, to perform some processing before the zoom is done
73 75 void onMouseWheel(QWheelEvent *event) noexcept;
74 76 /// Slot called when a mouse press was made, to activate the calibration of a graph
@@ -11,3 +11,7 VisualizationGraphRenderingDelegate::VisualizationGraphRenderingDelegate(QCustom
11 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 73 // - Mouse wheel on qcpplot is intercepted to determine the zoom orientation
74 74 ui->widget->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
75 75 ui->widget->axisRect()->setRangeDrag(Qt::Horizontal);
76
76 77 connect(ui->widget, &QCustomPlot::mousePress, this, &VisualizationGraphWidget::onMousePress);
77 78 connect(ui->widget, &QCustomPlot::mouseRelease, this,
78 79 &VisualizationGraphWidget::onMouseRelease);
80 connect(ui->widget, &QCustomPlot::mouseMove, this, &VisualizationGraphWidget::onMouseMove);
79 81 connect(ui->widget, &QCustomPlot::mouseWheel, this, &VisualizationGraphWidget::onMouseWheel);
80 82 connect(ui->widget->xAxis, static_cast<void (QCPAxis::*)(const QCPRange &, const QCPRange &)>(
81 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 348 void VisualizationGraphWidget::onMouseWheel(QWheelEvent *event) noexcept
341 349 {
342 350 auto zoomOrientations = QFlags<Qt::Orientation>{};
General Comments 0
You need to be logged in to leave comments. Login now