mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4892 Simplified Unlink View command. Works on pprimary view as well.
This commit is contained in:
parent
159d54477a
commit
1774d123cc
@ -31,6 +31,7 @@
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
#include "RimViewLinkerCollection.h"
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicUnLinkViewFeature, "RicUnLinkViewFeature" );
|
||||
|
||||
@ -43,9 +44,7 @@ bool RicUnLinkViewFeature::isCommandEnabled()
|
||||
;
|
||||
if ( !activeView ) return false;
|
||||
|
||||
RimViewController* viewController = activeView->viewController();
|
||||
|
||||
if ( viewController )
|
||||
if ( activeView->assosiatedViewLinker() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -63,16 +62,39 @@ void RicUnLinkViewFeature::onActionTriggered( bool isChecked )
|
||||
if ( !activeView ) return;
|
||||
|
||||
RimViewController* viewController = activeView->viewController();
|
||||
viewController->applyRangeFilterCollectionByUserChoice();
|
||||
RimViewLinker* viewLinker = activeView->assosiatedViewLinker();
|
||||
|
||||
caf::SelectionManager::instance()->setSelectedItem( viewController );
|
||||
caf::CmdFeature* feature = caf::CmdFeatureManager::instance()->getCommandFeature( "RicDeleteItemFeature" );
|
||||
if ( feature )
|
||||
if ( viewController )
|
||||
{
|
||||
feature->action()->trigger();
|
||||
|
||||
return;
|
||||
viewController->applyRangeFilterCollectionByUserChoice();
|
||||
delete viewController;
|
||||
viewLinker->removeViewController( nullptr ); // Remove the slots in the vector that was set to nullptr by the destructor
|
||||
}
|
||||
else if ( viewLinker )
|
||||
{
|
||||
viewLinker->applyRangeFilterCollectionByUserChoice();
|
||||
|
||||
RimGridView* firstControlledView = viewLinker->firstControlledView();
|
||||
|
||||
if ( firstControlledView )
|
||||
{
|
||||
viewLinker->setMasterView(firstControlledView);
|
||||
|
||||
viewLinker->updateDependentViews();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove the view linker object from the view linker collection
|
||||
// viewLinkerCollection->viewLinker is a PdmChildField containing one RimViewLinker child object
|
||||
RiaApplication::instance()->project()->viewLinkerCollection->viewLinker.removeChildObject(viewLinker);
|
||||
|
||||
delete viewLinker;
|
||||
}
|
||||
activeView->updateHolder();
|
||||
}
|
||||
|
||||
RiaApplication::instance()->project()->viewLinkerCollection.uiCapability()->updateConnectedEditors();
|
||||
RiaApplication::instance()->project()->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -82,5 +104,4 @@ void RicUnLinkViewFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Unlink View" );
|
||||
actionToSetup->setIcon( QIcon( ":/UnLinkView16x16.png" ) );
|
||||
|
||||
}
|
||||
|
@ -961,7 +961,7 @@ bool RimViewController::isRangeFiltersControlled() const
|
||||
{
|
||||
if ( !isRangeFilterControlPossible() ) return false;
|
||||
|
||||
if ( ownerViewLinker()->isActive() && this->m_isActive() )
|
||||
if (ownerViewLinker() && ownerViewLinker()->isActive() && this->m_isActive() )
|
||||
{
|
||||
return m_syncRangeFilters;
|
||||
}
|
||||
|
@ -278,6 +278,8 @@ void RimViewLinker::allViewsForCameraSync( const RimGridView* source, std::vecto
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewLinker::updateDependentViews()
|
||||
{
|
||||
if (m_viewControllers.empty()) return;
|
||||
|
||||
updateOverrides();
|
||||
updateCellResult();
|
||||
updateScaleZ( m_masterView, m_masterView->scaleZ() );
|
||||
@ -642,7 +644,7 @@ void RimViewLinker::addViewControllers( caf::PdmUiTreeOrdering& uiTreeOrdering )
|
||||
{
|
||||
for ( const auto& viewController : m_viewControllers )
|
||||
{
|
||||
uiTreeOrdering.add( viewController );
|
||||
if (viewController) uiTreeOrdering.add( viewController );
|
||||
}
|
||||
}
|
||||
|
||||
@ -675,3 +677,13 @@ void RimViewLinker::removeViewController( RimViewController* viewController )
|
||||
{
|
||||
m_viewControllers.removeChildObject( viewController );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridView* RimViewLinker::firstControlledView()
|
||||
{
|
||||
if (m_viewControllers.empty()) return nullptr;
|
||||
|
||||
return m_viewControllers[0]->managedView();
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ public:
|
||||
bool isFirstViewDependentOnSecondView( const RimGridView* firstView, const RimGridView* secondView ) const;
|
||||
void updateDependentViews();
|
||||
void removeViewController( RimViewController* viewController );
|
||||
RimGridView* firstControlledView();
|
||||
|
||||
void updateOverrides();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user