From 31b12999b5124a58b54e69bd65a13979702b5a1e Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 11 Nov 2016 11:41:08 +0100 Subject: [PATCH] #870 Detach plot marker when plot looses focus --- ApplicationCode/UserInterface/RiuSummaryQwtPlot.cpp | 13 +++++++++++++ ApplicationCode/UserInterface/RiuSummaryQwtPlot.h | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ApplicationCode/UserInterface/RiuSummaryQwtPlot.cpp b/ApplicationCode/UserInterface/RiuSummaryQwtPlot.cpp index c66620e49c..7366f9f7cf 100644 --- a/ApplicationCode/UserInterface/RiuSummaryQwtPlot.cpp +++ b/ApplicationCode/UserInterface/RiuSummaryQwtPlot.cpp @@ -358,6 +358,19 @@ bool RiuSummaryQwtPlot::eventFilter(QObject* watched, QEvent* event) } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuSummaryQwtPlot::leaveEvent(QEvent *) +{ + if (m_plotMarker->plot()) + { + m_plotMarker->detach(); + + replot(); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuSummaryQwtPlot.h b/ApplicationCode/UserInterface/RiuSummaryQwtPlot.h index f6360eda64..24fc61b706 100644 --- a/ApplicationCode/UserInterface/RiuSummaryQwtPlot.h +++ b/ApplicationCode/UserInterface/RiuSummaryQwtPlot.h @@ -58,7 +58,8 @@ class RiuSummaryQwtPlot : public QwtPlot void updateClosestCurvePointMarker(const QPointF& pos, int yAxis); protected: - virtual bool eventFilter(QObject* watched, QEvent* event); + virtual bool eventFilter(QObject* watched, QEvent* event) override; + virtual void leaveEvent(QEvent *) override; private: void setDefaults();