##// END OF EJS Templates
Shows/hides plot overlay when entering/leaving graph
Alexandre Leroux -
r669:f825dcc5246f
parent child
Show More
@@ -16,6 +16,9 public:
16
16
17 void onMouseMove(QMouseEvent *event) noexcept;
17 void onMouseMove(QMouseEvent *event) noexcept;
18
18
19 /// Shows or hides graph overlay (name, close button, etc.)
20 void showGraphOverlay(bool show) noexcept;
21
19 private:
22 private:
20 class VisualizationGraphRenderingDelegatePrivate;
23 class VisualizationGraphRenderingDelegatePrivate;
21 spimpl::unique_impl_ptr<VisualizationGraphRenderingDelegatePrivate> impl;
24 spimpl::unique_impl_ptr<VisualizationGraphRenderingDelegatePrivate> impl;
@@ -57,6 +57,9 signals:
57
57
58 void variableAdded(std::shared_ptr<Variable> var);
58 void variableAdded(std::shared_ptr<Variable> var);
59
59
60 protected:
61 void enterEvent(QEvent *event) override;
62 void leaveEvent(QEvent *event) override;
60
63
61 QCustomPlot &plot() noexcept;
64 QCustomPlot &plot() noexcept;
62
65
@@ -160,3 +160,10 void VisualizationGraphRenderingDelegate::onMouseMove(QMouseEvent *event) noexce
160 }
160 }
161 }
161 }
162 }
162 }
163
164 void VisualizationGraphRenderingDelegate::showGraphOverlay(bool show) noexcept
165 {
166 auto overlay = impl->m_Plot.layer(OVERLAY_LAYER);
167 overlay->setVisible(show);
168 overlay->replot();
169 }
@@ -204,6 +204,18 QString VisualizationGraphWidget::name() const
204 return impl->m_Name;
204 return impl->m_Name;
205 }
205 }
206
206
207 void VisualizationGraphWidget::enterEvent(QEvent *event)
208 {
209 Q_UNUSED(event);
210 impl->m_RenderingDelegate->showGraphOverlay(true);
211 }
212
213 void VisualizationGraphWidget::leaveEvent(QEvent *event)
214 {
215 Q_UNUSED(event);
216 impl->m_RenderingDelegate->showGraphOverlay(false);
217 }
218
207 QCustomPlot &VisualizationGraphWidget::plot() noexcept
219 QCustomPlot &VisualizationGraphWidget::plot() noexcept
208 {
220 {
209 return *ui->widget;
221 return *ui->widget;
General Comments 0
You need to be logged in to leave comments. Login now