Merge pull request #8765 from OPM/summarymultiplot_performance2

Summary Multiplot performance improvements and fixes
This commit is contained in:
jonjenssen
2022-04-01 19:23:27 +02:00
committed by GitHub
parent 46a8bd58b2
commit 22d6e3f853
19 changed files with 175 additions and 70 deletions

View File

@@ -183,6 +183,15 @@ void RiuMultiPlotBook::insertPlot( RiuPlotWidget* plotWidget, size_t index )
///
//--------------------------------------------------------------------------------------------------
void RiuMultiPlotBook::removePlot( RiuPlotWidget* plotWidget )
{
removePlotNoUpdate( plotWidget );
scheduleUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMultiPlotBook::removePlotNoUpdate( RiuPlotWidget* plotWidget )
{
if ( !plotWidget ) return;
@@ -190,8 +199,6 @@ void RiuMultiPlotBook::removePlot( RiuPlotWidget* plotWidget )
CVF_ASSERT( plotWidgetIdx >= 0 );
m_plotWidgets.removeAt( plotWidgetIdx );
scheduleUpdate();
}
//--------------------------------------------------------------------------------------------------
@@ -383,7 +390,8 @@ void RiuMultiPlotBook::showEvent( QShowEvent* event )
{
m_goToPageAfterUpdate = true;
QWidget::showEvent( event );
performUpdate();
const bool regeneratePages = false;
performUpdate( regeneratePages );
if ( m_previewMode )
{
applyPagePreviewBookSize( width() );
@@ -473,16 +481,19 @@ bool RiuMultiPlotBook::showYAxis( int row, int column ) const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMultiPlotBook::performUpdate()
void RiuMultiPlotBook::performUpdate( bool regeneratePages )
{
applyLook();
deleteAllPages();
createPages();
if ( regeneratePages || m_pages.size() == 0 )
{
deleteAllPages();
createPages();
}
updateGeometry();
// use a timer to trigger a viewer page change, if needed
if ( m_goToPageAfterUpdate )
{
m_pageTimerId = startTimer( 100 );
m_pageTimerId = startTimer( 50 );
m_goToPageAfterUpdate = false;
}
}

View File

@@ -62,6 +62,7 @@ public:
void addPlot( RiuPlotWidget* plotWidget );
void insertPlot( RiuPlotWidget* plotWidget, size_t index );
void removePlot( RiuPlotWidget* plotWidget );
void removePlotNoUpdate( RiuPlotWidget* plotWidget );
void removeAllPlots();
void setPlotTitle( const QString& plotTitle );
@@ -120,7 +121,7 @@ private:
void changeCurrentPage( int pageNumber );
private slots:
virtual void performUpdate();
virtual void performUpdate( bool regeneratePages );
protected:
friend class RiaPlotWindowRedrawScheduler;

View File

@@ -62,6 +62,7 @@
#include <QPainter>
#include <QScrollBar>
#include <QTimer>
#include <QWidget>
#include <cmath>

View File

@@ -30,10 +30,10 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuSummaryQtChartsPlot::RiuSummaryQtChartsPlot( RimSummaryPlot* plot )
RiuSummaryQtChartsPlot::RiuSummaryQtChartsPlot( RimSummaryPlot* plot, QWidget* parent )
: RiuSummaryPlot( plot )
{
m_plotWidget = new RiuQtChartsPlotWidget( plot, nullptr, new RimEnsembleCurveInfoTextProvider );
m_plotWidget = new RiuQtChartsPlotWidget( plot, parent, new RimEnsembleCurveInfoTextProvider );
m_plotWidget->setContextMenuPolicy( Qt::CustomContextMenu );
connect( m_plotWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( showContextMenu( QPoint ) ) );

View File

@@ -25,6 +25,7 @@
#include <QPointer>
class QWidget;
class RimSummaryPlot;
class RimPlotAxisPropertiesInterface;
@@ -38,7 +39,7 @@ class RiuSummaryQtChartsPlot : public RiuSummaryPlot
Q_OBJECT;
public:
RiuSummaryQtChartsPlot( RimSummaryPlot* plot );
RiuSummaryQtChartsPlot( RimSummaryPlot* plot, QWidget* parent );
~RiuSummaryQtChartsPlot() override;
void useDateBasedTimeAxis(