@@ -113,15 +113,10 @@ class TimeReadoutPicker : public QwtPlotPicker
113113 auto * timeAxisProps = m_summaryPlot->timeAxisProperties ();
114114 if ( timeAxisProps )
115115 {
116- if ( m_trackingAnnotation )
117- {
118- timeAxisProps->removeAnnotation ( m_trackingAnnotation );
119- m_trackingAnnotation = nullptr ;
120- }
116+ removeTrackingAnnotation ( timeAxisProps );
121117 auto * anno = RimTimeAxisAnnotation::createTimeAnnotation ( timeTValue, TRACKING_ANNOTATION_COLOR );
122118 anno->setPenStyle ( Qt::DashLine );
123119 timeAxisProps->appendAnnotation ( anno );
124- m_trackingAnnotation = anno;
125120 }
126121
127122 m_summaryPlot->updateAnnotationsInPlotWidget ();
@@ -132,22 +127,34 @@ class TimeReadoutPicker : public QwtPlotPicker
132127
133128 void widgetLeaveEvent ( QEvent* ) override
134129 {
135- if ( m_trackingAnnotation && m_summaryPlot )
130+ if ( !m_summaryPlot ) return ;
131+
132+ auto * timeAxisProps = m_summaryPlot->timeAxisProperties ();
133+ if ( timeAxisProps && removeTrackingAnnotation ( timeAxisProps ) )
136134 {
137- auto * timeAxisProps = m_summaryPlot->timeAxisProperties ();
138- if ( timeAxisProps )
139- {
140- timeAxisProps->removeAnnotation ( m_trackingAnnotation );
141- m_trackingAnnotation = nullptr ;
142- }
143135 m_summaryPlot->updateAnnotationsInPlotWidget ();
144136 m_summaryPlot->updatePlotWidgetFromAxisRanges ();
145137 }
146138 }
147139
148140private:
149- caf::PdmPointer<RimSummaryPlot> m_summaryPlot;
150- mutable caf::PdmPointer<RimTimeAxisAnnotation> m_trackingAnnotation;
141+ static bool removeTrackingAnnotation ( RimSummaryTimeAxisProperties* timeAxisProps )
142+ {
143+ if ( !timeAxisProps ) return false ;
144+ for ( auto * anno : timeAxisProps->annotations () )
145+ {
146+ // Identify the tracking annotation by its pen style, which is unique among time axis annotations. This way we don't interfere
147+ // with the selected-time annotation, which is also on the time axis.
148+ if ( anno->penStyle () == Qt::DashLine )
149+ {
150+ timeAxisProps->removeAnnotation ( dynamic_cast <RimTimeAxisAnnotation*>( anno ) );
151+ return true ;
152+ }
153+ }
154+ return false ;
155+ }
156+
157+ caf::PdmPointer<RimSummaryPlot> m_summaryPlot;
151158};
152159
153160namespace
@@ -280,8 +287,15 @@ QString RimCorrelationReportPlot::description() const
280287// --------------------------------------------------------------------------------------------------
281288QImage RimCorrelationReportPlot::snapshotWindowContent ()
282289{
283- if ( m_viewWidget ) return m_viewWidget->grab ().toImage ();
284- return {};
290+ QImage image;
291+
292+ if ( m_viewWidget )
293+ {
294+ QPixmap pix = m_viewWidget->grab ();
295+ image = pix.toImage ();
296+ }
297+
298+ return image;
285299}
286300
287301// --------------------------------------------------------------------------------------------------
@@ -580,13 +594,8 @@ void RimCorrelationReportPlot::onLoadDataAndUpdate()
580594 m_parameterResultCrossPlot->setAxisValueFontSize ( m_axisValueFontSize () );
581595
582596 m_correlationMatrixPlot->loadDataAndUpdate ();
583- if ( m_correlationMatrixPlot->viewer () ) m_correlationMatrixPlot->viewer ()->setPlotTitleEnabled ( true );
584-
585597 m_correlationPlot->loadDataAndUpdate ();
586- if ( m_correlationPlot->viewer () ) m_correlationPlot->viewer ()->setPlotTitleEnabled ( true );
587-
588598 m_parameterResultCrossPlot->loadDataAndUpdate ();
589- if ( m_parameterResultCrossPlot->viewer () ) m_parameterResultCrossPlot->viewer ()->setPlotTitleEnabled ( true );
590599
591600 if ( m_showSummaryPlot () )
592601 {
0 commit comments