mirror of
https://github.com/OPM/ResInsight.git
synced 2026-11-18 03:49:47 -06:00
Simplify RiuPlotMainWindowTools (#9211)
* Janitor: Add and use onObjectAppended() * Janitor: Simplify API
This commit is contained in:
1 parent
febbdcf7a0
commit
a1e7b64d92
34 files changed
+66
-93
No files matched your search
@@ -47,25 +47,27 @@ void RiuPlotMainWindowTools::setActiveViewer( QWidget* subWindow )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPlotMainWindowTools::setExpanded( const caf::PdmUiItem* uiItem, bool expanded /*= true*/ )
|
||||
void RiuPlotMainWindowTools::setExpanded( const caf::PdmUiItem* uiItem )
|
||||
{
|
||||
if ( RiaGuiApplication::isRunning() )
|
||||
{
|
||||
RiuPlotMainWindow* mpw = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
|
||||
if ( mpw ) mpw->setExpanded( uiItem, expanded );
|
||||
bool expand = true;
|
||||
if ( mpw ) mpw->setExpanded( uiItem, expand );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPlotMainWindowTools::selectAsCurrentItem( const caf::PdmObject* object, bool allowActiveViewChange /*= true*/ )
|
||||
void RiuPlotMainWindowTools::selectAsCurrentItem( const caf::PdmObject* object )
|
||||
{
|
||||
if ( RiaGuiApplication::isRunning() )
|
||||
{
|
||||
RiuPlotMainWindow* mpw = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
|
||||
bool allowActiveViewChange = true;
|
||||
if ( mpw ) mpw->selectAsCurrentItem( object, allowActiveViewChange );
|
||||
}
|
||||
}
|
||||
@@ -73,12 +75,13 @@ void RiuPlotMainWindowTools::selectAsCurrentItem( const caf::PdmObject* object,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPlotMainWindowTools::toggleItemInSelection( const caf::PdmObject* object, bool allowActiveViewChange /*= true*/ )
|
||||
void RiuPlotMainWindowTools::toggleItemInSelection( const caf::PdmObject* object )
|
||||
{
|
||||
if ( RiaGuiApplication::isRunning() )
|
||||
{
|
||||
RiuPlotMainWindow* mpw = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
|
||||
bool allowActiveViewChange = true;
|
||||
if ( mpw ) mpw->toggleItemInSelection( object, allowActiveViewChange );
|
||||
}
|
||||
}
|
||||
@@ -114,3 +117,16 @@ void RiuPlotMainWindowTools::refreshToolbars()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPlotMainWindowTools::onObjectAppended( const caf::PdmObject* objectToSelect, const caf::PdmObject* objectToExpand )
|
||||
{
|
||||
if ( objectToExpand == nullptr ) objectToExpand = objectToSelect;
|
||||
|
||||
if ( objectToExpand ) RiuPlotMainWindowTools::setExpanded( objectToExpand );
|
||||
if ( objectToSelect ) RiuPlotMainWindowTools::selectAsCurrentItem( objectToSelect );
|
||||
|
||||
RiuPlotMainWindowTools::refreshToolbars();
|
||||
}
|
||||
Reference in new issue
Block a user