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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 175 additions and 70 deletions

View File

@ -118,7 +118,8 @@ void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots()
if ( pagesToUpdate.count( page ) > 0 ) pagesToUpdate.erase( page ); if ( pagesToUpdate.count( page ) > 0 ) pagesToUpdate.erase( page );
} }
plotWindow->performUpdate(); const bool regeneratePages = true;
plotWindow->performUpdate( regeneratePages );
updatedPlotWindows.insert( plotWindow ); updatedPlotWindows.insert( plotWindow );
} }
} }

View File

@ -336,7 +336,14 @@ RimMultiPlot* RicSummaryPlotBuilder::createAndAppendMultiPlot( const std::vector
plotCollection->updateAllRequiredEditors(); plotCollection->updateAllRequiredEditors();
plotWindow->loadDataAndUpdate(); plotWindow->loadDataAndUpdate();
if ( !plots.empty() )
{
RiuPlotMainWindowTools::selectAsCurrentItem( plots[0], true );
}
else
{
RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow, true ); RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow, true );
}
return plotWindow; return plotWindow;
} }
@ -360,8 +367,16 @@ RimSummaryMultiPlot*
plotCollection->updateAllRequiredEditors(); plotCollection->updateAllRequiredEditors();
plotWindow->loadDataAndUpdate(); plotWindow->loadDataAndUpdate();
if ( plotWindow->summaryPlots().size() == 1 )
{
RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow->summaryPlots()[0] );
RiuPlotMainWindowTools::setExpanded( plotWindow->summaryPlots()[0], true );
}
else
{
RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow ); RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow );
RiuPlotMainWindowTools::setExpanded( plotWindow, true ); RiuPlotMainWindowTools::setExpanded( plotWindow, true );
}
return plotWindow; return plotWindow;
} }
@ -425,7 +440,7 @@ RimSummaryMultiPlot*
plotWindow->loadDataAndUpdate(); plotWindow->loadDataAndUpdate();
plotWindow->updateAllRequiredEditors(); plotWindow->updateAllRequiredEditors();
RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow ); RiuPlotMainWindowTools::selectAsCurrentItem( plot );
return plotWindow; return plotWindow;
} }
@ -448,7 +463,14 @@ RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( con
plotWindow->loadDataAndUpdate(); plotWindow->loadDataAndUpdate();
plotWindow->updateAllRequiredEditors(); plotWindow->updateAllRequiredEditors();
if ( !plots.empty() )
{
RiuPlotMainWindowTools::selectAsCurrentItem( plots[0] );
}
else
{
RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow ); RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow );
}
return plotWindow; return plotWindow;
} }

View File

@ -75,7 +75,7 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked )
std::vector<RimPlot*> selection; std::vector<RimPlot*> selection;
caf::SelectionManager::instance()->objectsByType( &selection ); caf::SelectionManager::instance()->objectsByType( &selection );
std::set<RimPlotWindow*> alteredPlotWindows; std::set<RimMultiPlot*> alteredPlotWindows;
for ( RimPlot* plot : selection ) for ( RimPlot* plot : selection )
{ {
@ -94,18 +94,22 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked )
if ( multiPlot ) if ( multiPlot )
{ {
alteredPlotWindows.insert( multiPlot ); alteredPlotWindows.insert( multiPlot );
multiPlot->removePlot( plot ); multiPlot->removePlotNoUpdate( plot );
multiPlot->updateConnectedEditors(); multiPlot->updateConnectedEditors();
delete plot; delete plot;
} }
else if ( wellLogPlot ) else if ( wellLogPlot )
{ {
alteredPlotWindows.insert( wellLogPlot );
wellLogPlot->removePlot( plot ); wellLogPlot->removePlot( plot );
wellLogPlot->updateConnectedEditors(); wellLogPlot->updateConnectedEditors();
delete plot; delete plot;
} }
} }
for ( auto mainplot : alteredPlotWindows )
{
mainplot->updateAfterPlotRemove();
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -190,10 +190,9 @@ void RimMultiPlot::insertPlot( RimPlot* plot, size_t index )
if ( m_viewer ) if ( m_viewer )
{ {
plot->createPlotWidget(); plot->createPlotWidget( m_viewer );
m_viewer->insertPlot( plot->plotWidget(), index ); m_viewer->insertPlot( plot->plotWidget(), index );
} }
plot->setShowWindow( true );
plot->updateAfterInsertingIntoMultiPlot(); plot->updateAfterInsertingIntoMultiPlot();
onPlotAdditionOrRemoval(); onPlotAdditionOrRemoval();
@ -217,6 +216,29 @@ void RimMultiPlot::removePlot( RimPlot* plot )
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::removePlotNoUpdate( RimPlot* plot )
{
if ( plot )
{
if ( m_viewer )
{
m_viewer->removePlotNoUpdate( plot->plotWidget() );
}
m_plots.removeChildObject( plot );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiPlot::updateAfterPlotRemove()
{
onPlotAdditionOrRemoval();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -851,7 +873,7 @@ void RimMultiPlot::recreatePlotWidgets()
for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx ) for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx )
{ {
plotVector[tIdx]->createPlotWidget(); plotVector[tIdx]->createPlotWidget( m_viewer );
m_viewer->addPlot( plotVector[tIdx]->plotWidget() ); m_viewer->addPlot( plotVector[tIdx]->plotWidget() );
} }
} }

View File

@ -69,6 +69,9 @@ public:
void removePlot( RimPlot* plot ) override; void removePlot( RimPlot* plot ) override;
void movePlotsToThis( const std::vector<RimPlot*>& plots, int insertAtPosition ); void movePlotsToThis( const std::vector<RimPlot*>& plots, int insertAtPosition );
virtual void removePlotNoUpdate( RimPlot* plot );
virtual void updateAfterPlotRemove();
void deleteAllPlots() override; void deleteAllPlots() override;
size_t plotCount() const override; size_t plotCount() const override;
@ -122,15 +125,18 @@ protected:
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override; bool* useOptionsOnly ) override;
void onLoadDataAndUpdate() override; void onLoadDataAndUpdate() override;
void initAfterRead() override; void initAfterRead() override;
void applyPlotWindowTitleToWidgets(); void applyPlotWindowTitleToWidgets();
void updatePlots(); void updatePlots();
void updateZoom(); void updateZoom();
void recreatePlotWidgets(); void recreatePlotWidgets();
virtual void updatePlotWindowTitle(); virtual void updatePlotWindowTitle();
void onPlotAdditionOrRemoval();
bool isMouseCursorInsidePlot(); bool isMouseCursorInsidePlot();
@ -140,7 +146,6 @@ private:
void doUpdateLayout() override; void doUpdateLayout() override;
void updateSubPlotNames(); void updateSubPlotNames();
void doRenderWindowContent( QPaintDevice* paintDevice ) override; void doRenderWindowContent( QPaintDevice* paintDevice ) override;
void onPlotAdditionOrRemoval();
void onPlotsReordered( const caf::SignalEmitter* emitter ); void onPlotsReordered( const caf::SignalEmitter* emitter );
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects ) override; std::vector<caf::PdmObjectHandle*>& referringObjects ) override;

View File

@ -159,9 +159,6 @@ void RimPlot::removeFromMdiAreaAndCollection()
void RimPlot::updateAfterInsertingIntoMultiPlot() void RimPlot::updateAfterInsertingIntoMultiPlot()
{ {
loadDataAndUpdate(); loadDataAndUpdate();
/* updateLegend();
updateAxes();
updateLayout(); */
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -93,13 +93,21 @@ void RimEnsembleCurveSetCollection::loadDataAndUpdate( bool updateParentPlot )
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSetCollection::setParentPlotAndReplot( RiuPlotWidget* plot ) void RimEnsembleCurveSetCollection::setParentPlotAndReplot( RiuPlotWidget* plot )
{
setParentPlotNoReplot( plot );
if ( plot ) plot->replot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEnsembleCurveSetCollection::setParentPlotNoReplot( RiuPlotWidget* plot )
{ {
for ( RimEnsembleCurveSet* curveSet : m_curveSets ) for ( RimEnsembleCurveSet* curveSet : m_curveSets )
{ {
curveSet->setParentPlotNoReplot( plot ); curveSet->setParentPlotNoReplot( plot );
} }
if ( plot ) plot->replot();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -44,6 +44,7 @@ public:
void loadDataAndUpdate( bool updateParentPlot ); void loadDataAndUpdate( bool updateParentPlot );
void setParentPlotAndReplot( RiuPlotWidget* plot ); void setParentPlotAndReplot( RiuPlotWidget* plot );
void setParentPlotNoReplot( RiuPlotWidget* plot );
void detachPlotCurves(); void detachPlotCurves();
void reattachPlotCurves(); void reattachPlotCurves();

View File

@ -125,13 +125,21 @@ void RimSummaryCurveCollection::loadDataAndUpdate( bool updateParentPlot )
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimSummaryCurveCollection::setParentPlotAndReplot( RiuPlotWidget* plot ) void RimSummaryCurveCollection::setParentPlotAndReplot( RiuPlotWidget* plot )
{
setParentPlotNoReplot( plot );
if ( plot ) plot->replot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCurveCollection::setParentPlotNoReplot( RiuPlotWidget* plot )
{ {
for ( RimSummaryCurve* curve : m_curves ) for ( RimSummaryCurve* curve : m_curves )
{ {
curve->setParentPlotNoReplot( plot ); curve->setParentPlotNoReplot( plot );
} }
if ( plot ) plot->replot();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -64,6 +64,7 @@ public:
private: private:
void setParentPlotAndReplot( RiuPlotWidget* plot ); void setParentPlotAndReplot( RiuPlotWidget* plot );
void setParentPlotNoReplot( RiuPlotWidget* plot );
void detachPlotCurves(); void detachPlotCurves();
void reattachPlotCurves(); void reattachPlotCurves();

View File

@ -52,7 +52,6 @@ CAF_PDM_SOURCE_INIT( RimSummaryMultiPlot, "MultiSummaryPlot" );
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimSummaryMultiPlot::RimSummaryMultiPlot() RimSummaryMultiPlot::RimSummaryMultiPlot()
: duplicatePlot( this ) : duplicatePlot( this )
, refreshTree( this )
{ {
CAF_PDM_InitObject( "Multi Summary Plot" ); CAF_PDM_InitObject( "Multi Summary Plot" );
this->setDeletable( true ); this->setDeletable( true );
@ -117,7 +116,6 @@ void RimSummaryMultiPlot::insertPlot( RimPlot* plot, size_t index )
{ {
sumPlot->curvesChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged ); sumPlot->curvesChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged );
RimMultiPlot::insertPlot( plot, index ); RimMultiPlot::insertPlot( plot, index );
signalRefresh();
} }
} }
@ -150,10 +148,30 @@ void RimSummaryMultiPlot::removePlot( RimPlot* plot )
if ( sumPlot ) if ( sumPlot )
{ {
RimMultiPlot::removePlot( plot ); RimMultiPlot::removePlot( plot );
signalRefresh();
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryMultiPlot::removePlotNoUpdate( RimPlot* plot )
{
RimSummaryPlot* sumPlot = dynamic_cast<RimSummaryPlot*>( plot );
CVF_ASSERT( sumPlot != nullptr );
if ( sumPlot )
{
RimMultiPlot::removePlotNoUpdate( plot );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryMultiPlot::updateAfterPlotRemove()
{
onPlotAdditionOrRemoval();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -387,6 +405,21 @@ std::vector<RimSummaryPlot*> RimSummaryMultiPlot::summaryPlots() const
return typedPlots; return typedPlots;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimSummaryPlot*> RimSummaryMultiPlot::visibleSummaryPlots() const
{
std::vector<RimSummaryPlot*> visiblePlots;
for ( auto plot : summaryPlots() )
{
if ( plot->showWindow() ) visiblePlots.push_back( plot );
}
return visiblePlots;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -535,14 +568,6 @@ void RimSummaryMultiPlot::duplicate()
duplicatePlot.send( this ); duplicatePlot.send( this );
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryMultiPlot::signalRefresh()
{
refreshTree.send( this );
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -46,7 +46,6 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep
public: public:
caf::Signal<RimSummaryMultiPlot*> duplicatePlot; caf::Signal<RimSummaryMultiPlot*> duplicatePlot;
caf::Signal<RimSummaryMultiPlot*> refreshTree;
public: public:
RimSummaryMultiPlot(); RimSummaryMultiPlot();
@ -66,6 +65,9 @@ public:
void insertPlot( RimPlot* plot, size_t index ) override; void insertPlot( RimPlot* plot, size_t index ) override;
void removePlot( RimPlot* plot ) override; void removePlot( RimPlot* plot ) override;
void removePlotNoUpdate( RimPlot* plot ) override;
void updateAfterPlotRemove() override;
std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar(); std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
void syncAxisRanges(); void syncAxisRanges();
@ -75,6 +77,7 @@ public:
void summaryPlotItemInfos( QList<caf::PdmOptionItemInfo>* optionInfos ) const; void summaryPlotItemInfos( QList<caf::PdmOptionItemInfo>* optionInfos ) const;
std::vector<RimSummaryPlot*> summaryPlots() const; std::vector<RimSummaryPlot*> summaryPlots() const;
std::vector<RimSummaryPlot*> visibleSummaryPlots() const;
protected: protected:
bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override; bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override;
@ -93,7 +96,6 @@ private:
void updatePlotWindowTitle() override; void updatePlotWindowTitle() override;
void duplicate(); void duplicate();
void signalRefresh();
void onSubPlotChanged( const caf::SignalEmitter* emitter ); void onSubPlotChanged( const caf::SignalEmitter* emitter );

View File

@ -55,7 +55,6 @@ void RimSummaryMultiPlotCollection::initAfterRead()
for ( auto& plot : m_summaryMultiPlots ) for ( auto& plot : m_summaryMultiPlots )
{ {
plot->duplicatePlot.connect( this, &RimSummaryMultiPlotCollection::onDuplicatePlot ); plot->duplicatePlot.connect( this, &RimSummaryMultiPlotCollection::onDuplicatePlot );
plot->refreshTree.connect( this, &RimSummaryMultiPlotCollection::onRefreshTree );
} }
} }
@ -82,7 +81,6 @@ void RimSummaryMultiPlotCollection::addSummaryMultiPlot( RimSummaryMultiPlot* pl
{ {
m_summaryMultiPlots().push_back( plot ); m_summaryMultiPlots().push_back( plot );
plot->duplicatePlot.connect( this, &RimSummaryMultiPlotCollection::onDuplicatePlot ); plot->duplicatePlot.connect( this, &RimSummaryMultiPlotCollection::onDuplicatePlot );
plot->refreshTree.connect( this, &RimSummaryMultiPlotCollection::onRefreshTree );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -140,15 +138,8 @@ void RimSummaryMultiPlotCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering
QString uiConfigName /*= ""*/ ) QString uiConfigName /*= ""*/ )
{ {
for ( auto& plot : m_summaryMultiPlots() ) for ( auto& plot : m_summaryMultiPlots() )
{
if ( plot->summaryPlots().size() == 1 )
{
uiTreeOrdering.add( plot->summaryPlots()[0] );
}
else
{ {
uiTreeOrdering.add( plot ); uiTreeOrdering.add( plot );
} }
}
uiTreeOrdering.skipRemainingChildren( true ); uiTreeOrdering.skipRemainingChildren( true );
} }

View File

@ -1586,7 +1586,10 @@ void RimSummaryPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin
void RimSummaryPlot::onLoadDataAndUpdate() void RimSummaryPlot::onLoadDataAndUpdate()
{ {
updatePlotTitle(); updatePlotTitle();
updateMdiWindowVisibility();
RimMultiPlot* plotWindow = nullptr;
firstAncestorOrThisOfType( plotWindow );
if ( plotWindow == nullptr ) updateMdiWindowVisibility();
if ( m_summaryCurveCollection ) if ( m_summaryCurveCollection )
{ {
@ -1623,8 +1626,8 @@ void RimSummaryPlot::onLoadDataAndUpdate()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimSummaryPlot::updateZoomInParentPlot() void RimSummaryPlot::updateZoomInParentPlot()
{ {
if ( plotWidget() ) if ( !plotWidget() ) return;
{
for ( const auto& axisProperty : m_axisProperties ) for ( const auto& axisProperty : m_axisProperties )
{ {
updateZoomForAxis( axisProperty->plotAxisType() ); updateZoomForAxis( axisProperty->plotAxisType() );
@ -1635,7 +1638,6 @@ void RimSummaryPlot::updateZoomInParentPlot()
plotWidget()->updateZoomDependentCurveProperties(); plotWidget()->updateZoomDependentCurveProperties();
plotWidget()->scheduleReplot(); plotWidget()->scheduleReplot();
} }
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -2180,7 +2182,7 @@ RiuPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent
if ( useQtCharts ) if ( useQtCharts )
{ {
m_summaryPlot = std::make_unique<RiuSummaryQtChartsPlot>( this ); m_summaryPlot = std::make_unique<RiuSummaryQtChartsPlot>( this, mainWindowParent );
} }
else else
{ {
@ -2207,12 +2209,12 @@ RiuPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent
if ( m_summaryCurveCollection ) if ( m_summaryCurveCollection )
{ {
m_summaryCurveCollection->setParentPlotAndReplot( plotWidget() ); m_summaryCurveCollection->setParentPlotNoReplot( plotWidget() );
} }
if ( m_ensembleCurveSetCollection ) if ( m_ensembleCurveSetCollection )
{ {
m_ensembleCurveSetCollection->setParentPlotAndReplot( plotWidget() ); m_ensembleCurveSetCollection->setParentPlotNoReplot( plotWidget() );
} }
this->connect( plotWidget(), SIGNAL( plotZoomed() ), SLOT( onPlotZoomed() ) ); this->connect( plotWidget(), SIGNAL( plotZoomed() ), SLOT( onPlotZoomed() ) );
@ -2220,6 +2222,8 @@ RiuPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent
updatePlotTitle(); updatePlotTitle();
} }
plotWidget()->setParent( mainWindowParent );
return plotWidget(); return plotWidget();
} }

View File

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

View File

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

View File

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

View File

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

View File

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