##// END OF EJS Templates
Shows/hides plot overlay when entering/leaving graph
Alexandre Leroux -
r728:f825dcc5246f
parent child
Show More
@@ -16,6 +16,9 public:
16 16
17 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 22 private:
20 23 class VisualizationGraphRenderingDelegatePrivate;
21 24 spimpl::unique_impl_ptr<VisualizationGraphRenderingDelegatePrivate> impl;
@@ -57,6 +57,9 signals:
57 57
58 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 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 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 219 QCustomPlot &VisualizationGraphWidget::plot() noexcept
208 220 {
209 221 return *ui->widget;
General Comments 0
You need to be logged in to leave comments. Login now