mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Enable reordering of plots within a multiplot
This commit is contained in:
committed by
Magne Sjaastad
parent
a3161047af
commit
ab3e43d8fb
@@ -28,6 +28,7 @@
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "cafPdmFieldReorderCapability.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
#include "cafPdmUiToolButtonEditor.h"
|
||||
|
||||
@@ -74,6 +75,8 @@ RimMultiPlot::RimMultiPlot()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_plots, "Plots", "", "", "", "" );
|
||||
m_plots.uiCapability()->setUiHidden( true );
|
||||
auto reorderability = caf::PdmFieldReorderCapability::addToField( &m_plots );
|
||||
reorderability->orderChanged.connect( this, &RimMultiPlot::onPlotsReordered );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_columnCount, "NumberOfColumns", "Number of Columns", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_rowsPerPage, "RowsPerPage", "Rows per Page", "", "", "" );
|
||||
@@ -203,6 +206,8 @@ void RimMultiPlot::insertPlot( RimPlot* plot, size_t index )
|
||||
m_viewer->insertPlot( plot->viewer(), index );
|
||||
}
|
||||
plot->setShowWindow( true );
|
||||
plot->setLegendsVisible( false );
|
||||
plot->setPlotTitleVisible( false );
|
||||
plot->updateAfterInsertingIntoMultiPlot();
|
||||
|
||||
onPlotAdditionOrRemoval();
|
||||
@@ -484,6 +489,16 @@ void RimMultiPlot::onPlotAdditionOrRemoval()
|
||||
RiuPlotMainWindowTools::refreshToolbars();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlot::onPlotsReordered( const caf::SignalEmitter* emitter )
|
||||
{
|
||||
updateSubPlotNames();
|
||||
recreatePlotWidgets();
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -704,6 +719,7 @@ void RimMultiPlot::onLoadDataAndUpdate()
|
||||
applyPlotWindowTitleToWidgets();
|
||||
updatePlots();
|
||||
updateLayout();
|
||||
RiuPlotMainWindowTools::refreshToolbars();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -760,6 +776,8 @@ void RimMultiPlot::recreatePlotWidgets()
|
||||
{
|
||||
CVF_ASSERT( m_viewer );
|
||||
|
||||
m_viewer->removeAllPlots();
|
||||
|
||||
auto plotVector = plots();
|
||||
|
||||
for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx )
|
||||
|
||||
Reference in New Issue
Block a user