mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#6266 Fix unwanted selection change when changing window focus
This commit is contained in:
parent
105deba056
commit
31246b59f3
@ -759,11 +759,14 @@ void RiuPlotMainWindow::slotSubWindowActivated( QMdiSubWindow* subWindow )
|
||||
caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>( uiItem );
|
||||
if ( pdmObject )
|
||||
{
|
||||
RimViewWindow* owningView = nullptr;
|
||||
pdmObject->firstAncestorOrThisOfType( owningView );
|
||||
if ( owningView && owningView == activatedView )
|
||||
std::vector<RimViewWindow*> ancestralViews;
|
||||
pdmObject->allAncestorsOrThisOfType( ancestralViews );
|
||||
for ( auto ancestralView : ancestralViews )
|
||||
{
|
||||
childSelected = true;
|
||||
if ( ancestralView == activatedView )
|
||||
{
|
||||
childSelected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,12 @@ public:
|
||||
template <typename T>
|
||||
void firstAncestorOrThisOfTypeAsserted( T*& ancestor ) const;
|
||||
|
||||
template <typename T>
|
||||
void allAncestorsOfType( std::vector<T*>& ancestors ) const;
|
||||
|
||||
template <typename T>
|
||||
void allAncestorsOrThisOfType( std::vector<T*>& ancestors ) const;
|
||||
|
||||
/// Traverses all children recursively to find objects of the requested type. This object is also
|
||||
/// included if it is of the requested type.
|
||||
template <typename T>
|
||||
@ -196,6 +202,36 @@ void PdmObjectHandle::firstAncestorOrThisOfTypeAsserted( T*& ancestor ) const
|
||||
CAF_ASSERT( ancestor );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
void PdmObjectHandle::allAncestorsOfType( std::vector<T*>& ancestors ) const
|
||||
{
|
||||
T* firstAncestor = nullptr;
|
||||
this->firstAncestorOfType( firstAncestor );
|
||||
if ( firstAncestor )
|
||||
{
|
||||
ancestors.push_back( firstAncestor );
|
||||
firstAncestor->allAncestorsOfType( ancestors );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
void PdmObjectHandle::allAncestorsOrThisOfType( std::vector<T*>& ancestors ) const
|
||||
{
|
||||
T* firstAncestorOrThis = nullptr;
|
||||
this->firstAncestorOrThisOfType( firstAncestorOrThis );
|
||||
if ( firstAncestorOrThis )
|
||||
{
|
||||
ancestors.push_back( firstAncestorOrThis );
|
||||
firstAncestorOrThis->allAncestorsOfType( ancestors );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user