Minor GUI adjustments

* Select view when MDI window is activated

* Update linked views when property filter is linked

* Do not ask for restore of cell filters if none are present

* Update tree view when linking of property filters is disabled

* Add check box for multiple results in Result Info box
This commit is contained in:
Magne Sjaastad 2022-12-21 10:50:26 +01:00 committed by GitHub
parent de29b3b0ed
commit e815a02758
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 88 additions and 54 deletions

View File

@ -30,7 +30,7 @@ CAF_PDM_SOURCE_INIT( RimMultipleEclipseResults, "RimMultipleEclipseResults" );
//--------------------------------------------------------------------------------------------------
RimMultipleEclipseResults::RimMultipleEclipseResults()
{
CAF_PDM_InitObject( "Result Info Data", ":/TextAnnotation16x16.png" );
CAF_PDM_InitObject( "Multiple Result Info", ":/TextAnnotation16x16.png" );
CAF_PDM_InitFieldNoDefault( &m_selectedKeywords, "SelectedProperties", "Properties" );
m_selectedKeywords.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
@ -51,7 +51,7 @@ void RimMultipleEclipseResults::setEclipseView( RimEclipseView* eclipseView )
//--------------------------------------------------------------------------------------------------
std::vector<RigEclipseResultAddress> RimMultipleEclipseResults::additionalResultAddresses() const
{
if ( !m_eclipseView || !m_eclipseView->currentGridCellResults() ) return {};
if ( !m_eclipseView || !m_eclipseView->currentGridCellResults() || !m_isChecked ) return {};
std::set<QString> selectedResults;
for ( const auto& result : m_selectedKeywords() )

View File

@ -18,8 +18,7 @@
#pragma once
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "RimCheckableObject.h"
#include <QString>
@ -30,7 +29,7 @@ class RimEclipseView;
///
///
//==================================================================================================
class RimMultipleEclipseResults : public caf::PdmObject
class RimMultipleEclipseResults : public RimCheckableObject
{
CAF_PDM_HEADER_INIT;

View File

@ -499,7 +499,28 @@ void RimViewController::updateDisplayNameAndIcon()
//--------------------------------------------------------------------------------------------------
void RimViewController::updateDuplicatedPropertyFilters()
{
if ( !m_duplicatePropertyFilters ) return;
if ( !m_duplicatePropertyFilters )
{
// A chain icon is used to indicate that a property filter is linked. If a property filter is unlinked, update
// the property filters to make sure the chain icon is removed
std::vector<RimPropertyFilterCollection*> eclipsePropertyFilters;
RimProject::current()->descendantsIncludingThisOfType( eclipsePropertyFilters );
for ( auto p : eclipsePropertyFilters )
{
p->updateConnectedEditors();
}
std::vector<RimGeoMechPropertyFilterCollection*> geoMechPropertyFilters;
RimProject::current()->descendantsIncludingThisOfType( geoMechPropertyFilters );
for ( auto p : geoMechPropertyFilters )
{
p->updateConnectedEditors();
}
return;
}
RimViewLinker* viewLinker = ownerViewLinker();
@ -519,6 +540,9 @@ void RimViewController::updateDuplicatedPropertyFilters()
manEclView->eclipsePropertyFilterCollection()->loadAndInitializePropertyFilters();
manEclView->eclipsePropertyFilterCollection()->setIsDuplicatedFromLinkedView();
manEclView->eclipsePropertyFilterCollection()->updateAllRequiredEditors();
manEclView->scheduleGeometryRegen( PROPERTY_FILTERED );
manEclView->scheduleCreateDisplayModelAndRedraw();
}
auto* masterGeoView = dynamic_cast<RimGeoMechView*>( masterView );
@ -528,8 +552,11 @@ void RimViewController::updateDuplicatedPropertyFilters()
auto propertyString = masterGeoView->geoMechPropertyFilterCollection()->writeObjectToXmlString();
manGeoView->geoMechPropertyFilterCollection()->readObjectFromXmlString( propertyString,
caf::PdmDefaultObjectFactory::instance() );
managedGeoView()->geoMechPropertyFilterCollection()->loadAndInitializePropertyFilters();
managedGeoView()->geoMechPropertyFilterCollection()->updateAllRequiredEditors();
manGeoView->geoMechPropertyFilterCollection()->loadAndInitializePropertyFilters();
manGeoView->geoMechPropertyFilterCollection()->updateAllRequiredEditors();
manGeoView->scheduleGeometryRegen( PROPERTY_FILTERED );
manGeoView->scheduleCreateDisplayModelAndRedraw();
}
}
}
@ -1098,15 +1125,14 @@ void RimViewController::applyCellFilterCollectionByUserChoice()
RimViewLinker* viewLinker = ownerViewLinker();
auto* masterView = dynamic_cast<RimGridView*>( viewLinker->masterView() );
bool anyActiveFilter = false;
bool anyActiveCellFilter = false;
if ( masterView )
{
anyActiveFilter = !masterView->cellFilterCollection()->filters().empty() ||
masterView->propertyFilterCollection()->hasActiveFilters();
anyActiveCellFilter = !masterView->cellFilterCollection()->filters().empty();
}
if ( anyActiveFilter && askUserToRestoreOriginalCellFilterCollection( m_managedView->name() ) )
if ( anyActiveCellFilter && askUserToRestoreOriginalCellFilterCollection( m_managedView->name() ) )
{
managedGridView->setOverrideCellFilterCollection( nullptr );
}

View File

@ -34,6 +34,7 @@
#include "RimCellEdgeColors.h"
#include "RimCommandObject.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseContourMapView.h"
#include "RimEclipseFaultColors.h"
#include "RimEclipsePropertyFilter.h"
@ -1326,62 +1327,70 @@ void RiuMainWindow::selectViewInProjectTreePreservingSubItemSelection( const Rim
}
}
if ( is3dViewCurrentlySelected && ( previousActiveReservoirView != activatedView ) )
auto tv = getTreeViewWithItem( activatedView );
if ( !tv ) return;
QModelIndex newViewModelIndex = tv->findModelIndex( activatedView );
if ( !newViewModelIndex.isValid() ) return;
QModelIndex newSelectionIndex = newViewModelIndex;
if ( !is3dViewCurrentlySelected )
{
auto tv = getTreeViewWithItem( activatedView );
if ( !tv ) return;
std::vector<RimEclipseCellColors*> objects;
QModelIndex newViewModelIndex = tv->findModelIndex( activatedView );
if ( !newViewModelIndex.isValid() ) return;
QModelIndex newSelectionIndex = newViewModelIndex;
if ( previousActiveReservoirView && is3dViewCurrentlySelected )
activatedView->descendantsIncludingThisOfType( objects );
if ( !objects.empty() )
{
// Try to select the same entry in the new View, as was selected in the previous
auto candidate = tv->findModelIndex( objects.front() );
if ( candidate.isValid() ) newSelectionIndex = candidate;
}
}
else if ( previousActiveReservoirView && is3dViewCurrentlySelected )
{
// Try to select the same entry in the new View, as was selected in the previous
QModelIndex previousViewModelIndex = tv->findModelIndex( previousActiveReservoirView );
QModelIndex currentSelectionIndex = tv->treeView()->selectionModel()->currentIndex();
QModelIndex previousViewModelIndex = tv->findModelIndex( previousActiveReservoirView );
QModelIndex currentSelectionIndex = tv->treeView()->selectionModel()->currentIndex();
if ( currentSelectionIndex != newViewModelIndex && currentSelectionIndex.isValid() )
if ( currentSelectionIndex != newViewModelIndex && currentSelectionIndex.isValid() )
{
QVector<QModelIndex> route; // Contains all model indices from current selection up to previous view
QModelIndex tmpModelIndex = currentSelectionIndex;
while ( tmpModelIndex.isValid() && tmpModelIndex != previousViewModelIndex )
{
QVector<QModelIndex> route; // Contains all model indices from current selection up to previous view
// NB! Add model index to front of vector to be able to do a for-loop with correct ordering
route.push_front( tmpModelIndex );
QModelIndex tmpModelIndex = currentSelectionIndex;
tmpModelIndex = tmpModelIndex.parent();
}
while ( tmpModelIndex.isValid() && tmpModelIndex != previousViewModelIndex )
// Traverse model indices from new view index to currently selected item
int i;
for ( i = 0; i < route.size(); i++ )
{
QModelIndex tmp = route[i];
if ( newSelectionIndex.isValid() )
{
// NB! Add model index to front of vector to be able to do a for-loop with correct ordering
route.push_front( tmpModelIndex );
tmpModelIndex = tmpModelIndex.parent();
}
// Traverse model indices from new view index to currently selected item
int i;
for ( i = 0; i < route.size(); i++ )
{
QModelIndex tmp = route[i];
if ( newSelectionIndex.isValid() )
{
newSelectionIndex = tv->treeView()->model()->index( tmp.row(), tmp.column(), newSelectionIndex );
}
}
// Use view model index if anything goes wrong
if ( !newSelectionIndex.isValid() )
{
newSelectionIndex = newViewModelIndex;
newSelectionIndex = tv->treeView()->model()->index( tmp.row(), tmp.column(), newSelectionIndex );
}
}
}
tv->treeView()->setCurrentIndex( newSelectionIndex );
if ( newSelectionIndex != newViewModelIndex )
{
tv->treeView()->setExpanded( newViewModelIndex, true );
// Use view model index if anything goes wrong
if ( !newSelectionIndex.isValid() )
{
newSelectionIndex = newViewModelIndex;
}
}
}
tv->treeView()->setCurrentIndex( newSelectionIndex );
if ( newSelectionIndex != newViewModelIndex )
{
tv->treeView()->setExpanded( newViewModelIndex, true );
}
}
//--------------------------------------------------------------------------------------------------