Project Tree updates (#8490)

Split project tree into multiple dockable tree views for plots, keeping one for 3d views.
This commit is contained in:
jonjenssen 2022-01-28 13:19:52 +01:00 committed by GitHub
parent ffc77516e8
commit 66fd79175c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 436 additions and 304 deletions

View File

@ -314,3 +314,11 @@ bool RiaDefines::isInjector( WellProductionType wellProductionType )
return false; return false;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaDefines::stringListSeparator()
{
return "|";
}

View File

@ -185,4 +185,6 @@ enum class WellProductionType : short
bool isInjector( WellProductionType wellProductionType ); bool isInjector( WellProductionType wellProductionType );
QString stringListSeparator();
}; // namespace RiaDefines }; // namespace RiaDefines

View File

@ -22,6 +22,7 @@
#include "RiaArgumentParser.h" #include "RiaArgumentParser.h"
#include "RiaBaseDefs.h" #include "RiaBaseDefs.h"
#include "RiaDefines.h"
#include "RiaFilePathTools.h" #include "RiaFilePathTools.h"
#include "RiaFontCache.h" #include "RiaFontCache.h"
#include "RiaImportEclipseCaseTools.h" #include "RiaImportEclipseCaseTools.h"
@ -294,39 +295,46 @@ bool RiaGuiApplication::saveProjectAs( const QString& fileName )
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiaGuiApplication::storeTreeViewState() void RiaGuiApplication::storeTreeViewState()
{ {
if ( m_mainWindow )
{ {
if ( mainPlotWindow() && mainPlotWindow()->projectTreeView() ) QStringList treeStates;
QStringList treeIndexes;
for ( auto& tv : mainWindow()->projectTreeViews() )
{ {
caf::PdmUiTreeView* projectTreeView = mainPlotWindow()->projectTreeView();
QString treeViewState; QString treeViewState;
caf::QTreeViewStateSerializer::storeTreeViewStateToString( projectTreeView->treeView(), treeViewState ); caf::QTreeViewStateSerializer::storeTreeViewStateToString( tv->treeView(), treeViewState );
treeStates.append( treeViewState );
QModelIndex mi = projectTreeView->treeView()->currentIndex(); QModelIndex mi = tv->treeView()->currentIndex();
QString encodedModelIndexString;
QString encodedModelIndexString;
caf::QTreeViewStateSerializer::encodeStringFromModelIndex( mi, encodedModelIndexString ); caf::QTreeViewStateSerializer::encodeStringFromModelIndex( mi, encodedModelIndexString );
treeIndexes.append( encodedModelIndexString );
project()->plotWindowTreeViewState = treeViewState;
project()->plotWindowCurrentModelIndexPath = encodedModelIndexString;
} }
project()->mainWindowTreeViewStates = treeStates.join( RiaDefines::stringListSeparator() );
project()->mainWindowCurrentModelIndexPaths = treeIndexes.join( RiaDefines::stringListSeparator() );
} }
if ( m_mainPlotWindow )
{ {
caf::PdmUiTreeView* projectTreeView = m_mainWindow->projectTreeView(); QStringList treeStates;
if ( projectTreeView ) QStringList treeIndexes;
for ( auto& tv : mainPlotWindow()->projectTreeViews() )
{ {
QString treeViewState; QString treeViewState;
caf::QTreeViewStateSerializer::storeTreeViewStateToString( projectTreeView->treeView(), treeViewState ); caf::QTreeViewStateSerializer::storeTreeViewStateToString( tv->treeView(), treeViewState );
treeStates.append( treeViewState );
QModelIndex mi = projectTreeView->treeView()->currentIndex(); QModelIndex mi = tv->treeView()->currentIndex();
QString encodedModelIndexString;
QString encodedModelIndexString;
caf::QTreeViewStateSerializer::encodeStringFromModelIndex( mi, encodedModelIndexString ); caf::QTreeViewStateSerializer::encodeStringFromModelIndex( mi, encodedModelIndexString );
treeIndexes.append( encodedModelIndexString );
project()->mainWindowTreeViewState = treeViewState;
project()->mainWindowCurrentModelIndexPath = encodedModelIndexString;
} }
project()->plotWindowTreeViewStates = treeStates.join( RiaDefines::stringListSeparator() );
project()->plotWindowCurrentModelIndexPaths = treeIndexes.join( RiaDefines::stringListSeparator() );
} }
} }
@ -1380,13 +1388,19 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences*
caf::EffectGenerator::setRenderingMode( caf::EffectGenerator::FIXED_FUNCTION ); caf::EffectGenerator::setRenderingMode( caf::EffectGenerator::FIXED_FUNCTION );
} }
if ( m_mainWindow && m_mainWindow->projectTreeView() ) if ( m_mainWindow )
{ {
m_mainWindow->projectTreeView()->enableAppendOfClassNameToUiItemText( for ( auto& tv : mainWindow()->projectTreeViews() )
RiaPreferencesSystem::current()->appendClassNameToUiText() ); {
tv->enableAppendOfClassNameToUiItemText( RiaPreferencesSystem::current()->appendClassNameToUiText() );
}
if ( mainPlotWindow() ) if ( mainPlotWindow() )
mainPlotWindow()->projectTreeView()->enableAppendOfClassNameToUiItemText( {
RiaPreferencesSystem::current()->appendClassNameToUiText() ); for ( auto& tv : mainPlotWindow()->projectTreeViews() )
{
tv->enableAppendOfClassNameToUiItemText( RiaPreferencesSystem::current()->appendClassNameToUiText() );
}
}
} }
for ( auto fontObject : defaultFontObjects ) for ( auto fontObject : defaultFontObjects )

View File

@ -31,6 +31,7 @@
#include "cafSelectionManager.h" #include "cafSelectionManager.h"
#include <QAction> #include <QAction>
#include <QModelIndex>
CAF_CMD_SOURCE_INIT( RicMoveItemsToTopFeature, "RicMoveItemsToTopFeature" ); CAF_CMD_SOURCE_INIT( RicMoveItemsToTopFeature, "RicMoveItemsToTopFeature" );
@ -113,17 +114,17 @@ void RicMoveItemsToTopFeature::onActionTriggered( bool isChecked )
constSelectedItems.push_back( s ); constSelectedItems.push_back( s );
} }
caf::PdmUiTreeView* uiTreeView = RiaGuiApplication::activeMainWindow()->projectTreeView();
if ( !constSelectedItems.empty() ) if ( !constSelectedItems.empty() )
{ {
caf::PdmUiTreeView* uiTreeView =
RiaGuiApplication::activeMainWindow()->getTreeViewWithItem( constSelectedItems[0] );
QModelIndex itemIndex = uiTreeView->findModelIndex( constSelectedItems[0] ); QModelIndex itemIndex = uiTreeView->findModelIndex( constSelectedItems[0] );
QModelIndex parentIndex = itemIndex.parent(); QModelIndex parentIndex = itemIndex.parent();
uiTreeView->updateSubTree( parentIndex ); uiTreeView->updateSubTree( parentIndex );
}
// Restore selection highlight after reordering // Restore selection highlight after reordering
uiTreeView->selectItems( constSelectedItems ); uiTreeView->selectItems( constSelectedItems );
}
} }
} }
} }

View File

@ -158,31 +158,24 @@ void RicToggleItemsFeatureImpl::setObjectToggleStateForSelection( SelectionToggl
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
caf::PdmUiTreeView* RicToggleItemsFeatureImpl::findTreeView( const caf::PdmUiItem* uiItem ) caf::PdmUiTreeView* RicToggleItemsFeatureImpl::findTreeView( const caf::PdmUiItem* uiItem )
{ {
{ RiaFeatureCommandContext* context = RiaFeatureCommandContext::instance();
RiaFeatureCommandContext* context = RiaFeatureCommandContext::instance();
caf::PdmUiTreeView* customActiveTreeView = dynamic_cast<caf::PdmUiTreeView*>( context->object() ); caf::PdmUiTreeView* customActiveTreeView = dynamic_cast<caf::PdmUiTreeView*>( context->object() );
if ( customActiveTreeView ) if ( customActiveTreeView )
{ {
return customActiveTreeView; return customActiveTreeView;
}
} }
{ caf::PdmUiTreeView* activeTree = RiuMainWindow::instance()->getTreeViewWithItem( uiItem );
QModelIndex modIndex = RiuMainWindow::instance()->projectTreeView()->findModelIndex( uiItem ); if ( activeTree ) return activeTree;
if ( modIndex.isValid() )
{
return RiuMainWindow::instance()->projectTreeView();
}
}
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
if ( mainPlotWindow ) if ( mainPlotWindow )
{ {
QModelIndex modIndex = mainPlotWindow->projectTreeView()->findModelIndex( uiItem ); activeTree = mainPlotWindow->getTreeViewWithItem( uiItem );
if ( modIndex.isValid() ) if ( activeTree )
{ {
return mainPlotWindow->projectTreeView(); return activeTree;
} }
} }

View File

@ -167,19 +167,18 @@ RimProject::RimProject( void )
calculationCollection = new RimSummaryCalculationCollection; calculationCollection = new RimSummaryCalculationCollection;
CAF_PDM_InitFieldNoDefault( &commandObjects, "CommandObjects", "Command Objects" ); CAF_PDM_InitFieldNoDefault( &commandObjects, "CommandObjects", "Command Objects" );
// wellPathImport.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault( &multiSnapshotDefinitions, "MultiSnapshotDefinitions", "Multi Snapshot Definitions" ); CAF_PDM_InitFieldNoDefault( &multiSnapshotDefinitions, "MultiSnapshotDefinitions", "Multi Snapshot Definitions" );
CAF_PDM_InitFieldNoDefault( &mainWindowTreeViewState, "TreeViewState", "" ); CAF_PDM_InitFieldNoDefault( &mainWindowTreeViewStates, "TreeViewStates", "" );
mainWindowTreeViewState.uiCapability()->setUiHidden( true ); mainWindowTreeViewStates.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &mainWindowCurrentModelIndexPath, "TreeViewCurrentModelIndexPath", "" ); CAF_PDM_InitFieldNoDefault( &mainWindowCurrentModelIndexPaths, "TreeViewCurrentModelIndexPaths", "" );
mainWindowCurrentModelIndexPath.uiCapability()->setUiHidden( true ); mainWindowCurrentModelIndexPaths.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &plotWindowTreeViewState, "PlotWindowTreeViewState", "" ); CAF_PDM_InitFieldNoDefault( &plotWindowTreeViewStates, "PlotWindowTreeViewStates", "" );
plotWindowTreeViewState.uiCapability()->setUiHidden( true ); plotWindowTreeViewStates.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &plotWindowCurrentModelIndexPath, "PlotWindowTreeViewCurrentModelIndexPath", "" ); CAF_PDM_InitFieldNoDefault( &plotWindowCurrentModelIndexPaths, "PlotWindowTreeViewCurrentModelIndexPaths", "" );
plotWindowCurrentModelIndexPath.uiCapability()->setUiHidden( true ); plotWindowCurrentModelIndexPaths.uiCapability()->setUiHidden( true );
CAF_PDM_InitField( &m_show3DWindow, "show3DWindow", true, "Show 3D Window" ); CAF_PDM_InitField( &m_show3DWindow, "show3DWindow", true, "Show 3D Window" );
m_show3DWindow.uiCapability()->setUiHidden( true ); m_show3DWindow.uiCapability()->setUiHidden( true );
@ -271,10 +270,10 @@ void RimProject::close()
fileName = ""; fileName = "";
mainWindowCurrentModelIndexPath = ""; mainWindowCurrentModelIndexPaths = "";
mainWindowTreeViewState = ""; mainWindowTreeViewStates = "";
plotWindowCurrentModelIndexPath = ""; plotWindowCurrentModelIndexPaths = "";
plotWindowTreeViewState = ""; plotWindowTreeViewStates = "";
m_nextValidCaseId = 0; m_nextValidCaseId = 0;
m_nextValidCaseGroupId = 0; m_nextValidCaseGroupId = 0;
@ -308,7 +307,6 @@ void RimProject::initAfterRead()
if ( analysisModels ) if ( analysisModels )
{ {
analysisModels->caseGroups.push_back( sourceCaseGroup ); analysisModels->caseGroups.push_back( sourceCaseGroup );
// printf("Moved m_project->caseGroupsObsolete[%i] to first oil fields analysis models\n", cgIdx);
movedOneRimIdenticalGridCaseGroup = true; // moved at least one so assume the others will be moved too... movedOneRimIdenticalGridCaseGroup = true; // moved at least one so assume the others will be moved too...
} }
} }
@ -326,7 +324,6 @@ void RimProject::initAfterRead()
RimEclipseCase* sourceCase = casesObsolete[cIdx]; RimEclipseCase* sourceCase = casesObsolete[cIdx];
casesObsolete.set( cIdx, nullptr ); casesObsolete.set( cIdx, nullptr );
analysisModels->cases.push_back( sourceCase ); analysisModels->cases.push_back( sourceCase );
// printf("Moved m_project->casesObsolete[%i] to first oil fields analysis models\n", cIdx);
movedOneRimCase = true; // moved at least one so assume the others will be moved too... movedOneRimCase = true; // moved at least one so assume the others will be moved too...
} }
} }
@ -336,13 +333,6 @@ void RimProject::initAfterRead()
casesObsolete.clear(); casesObsolete.clear();
} }
if ( casesObsolete().size() > 0 || caseGroupsObsolete.size() > 0 )
{
// printf("RimProject::initAfterRead: Was not able to move all cases (%i left) or caseGroups (%i left) from
// Project to analysisModels",
// casesObsolete().size(), caseGroupsObsolete.size());
}
// Set project pointer to each well path // Set project pointer to each well path
for ( size_t oilFieldIdx = 0; oilFieldIdx < oilFields().size(); oilFieldIdx++ ) for ( size_t oilFieldIdx = 0; oilFieldIdx < oilFields().size(); oilFieldIdx++ )
{ {
@ -1387,101 +1377,79 @@ void RimProject::reloadCompletionTypeResultsForEclipseCase( RimEclipseCase* ecli
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ ) void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ )
{ {
if ( uiConfigName == "PlotWindow" ) if ( uiConfigName == "PlotWindow.Plots" )
{ {
{
auto itemCollection = uiTreeOrdering.add( "Data Sources", ":/Folder.png" );
RimOilField* oilField = activeOilField();
if ( oilField )
{
if ( oilField->summaryCaseMainCollection() )
{
itemCollection->add( oilField->summaryCaseMainCollection() );
}
if ( oilField->observedDataCollection() )
{
itemCollection->add( oilField->observedDataCollection() );
}
if ( oilField->ensembleWellLogsCollection() )
{
itemCollection->add( oilField->ensembleWellLogsCollection() );
}
}
}
if ( mainPlotCollection ) if ( mainPlotCollection )
{ {
auto itemCollection = uiTreeOrdering.add( "Plots", ":/Folder.png" );
if ( mainPlotCollection->summaryPlotCollection() ) if ( mainPlotCollection->summaryPlotCollection() )
{ {
itemCollection->add( mainPlotCollection->summaryPlotCollection() ); uiTreeOrdering.add( mainPlotCollection->summaryPlotCollection() );
} }
if ( mainPlotCollection->analysisPlotCollection() ) if ( mainPlotCollection->analysisPlotCollection() )
{ {
itemCollection->add( mainPlotCollection->analysisPlotCollection() ); uiTreeOrdering.add( mainPlotCollection->analysisPlotCollection() );
} }
if ( mainPlotCollection->correlationPlotCollection() ) if ( mainPlotCollection->correlationPlotCollection() )
{ {
itemCollection->add( mainPlotCollection->correlationPlotCollection() ); uiTreeOrdering.add( mainPlotCollection->correlationPlotCollection() );
} }
if ( mainPlotCollection->summaryCrossPlotCollection() ) if ( mainPlotCollection->summaryCrossPlotCollection() )
{ {
itemCollection->add( mainPlotCollection->summaryCrossPlotCollection() ); uiTreeOrdering.add( mainPlotCollection->summaryCrossPlotCollection() );
} }
if ( mainPlotCollection->wellLogPlotCollection() ) if ( mainPlotCollection->wellLogPlotCollection() )
{ {
itemCollection->add( mainPlotCollection->wellLogPlotCollection() ); uiTreeOrdering.add( mainPlotCollection->wellLogPlotCollection() );
} }
if ( mainPlotCollection->rftPlotCollection() ) if ( mainPlotCollection->rftPlotCollection() )
{ {
itemCollection->add( mainPlotCollection->rftPlotCollection() ); uiTreeOrdering.add( mainPlotCollection->rftPlotCollection() );
} }
if ( mainPlotCollection->pltPlotCollection() ) if ( mainPlotCollection->pltPlotCollection() )
{ {
itemCollection->add( mainPlotCollection->pltPlotCollection() ); uiTreeOrdering.add( mainPlotCollection->pltPlotCollection() );
} }
if ( mainPlotCollection->flowPlotCollection() ) if ( mainPlotCollection->flowPlotCollection() )
{ {
itemCollection->add( mainPlotCollection->flowPlotCollection() ); uiTreeOrdering.add( mainPlotCollection->flowPlotCollection() );
} }
if ( mainPlotCollection->gridCrossPlotCollection() ) if ( mainPlotCollection->gridCrossPlotCollection() )
{ {
itemCollection->add( mainPlotCollection->gridCrossPlotCollection() ); uiTreeOrdering.add( mainPlotCollection->gridCrossPlotCollection() );
} }
if ( mainPlotCollection->saturationPressurePlotCollection() ) if ( mainPlotCollection->saturationPressurePlotCollection() )
{ {
itemCollection->add( mainPlotCollection->saturationPressurePlotCollection() ); uiTreeOrdering.add( mainPlotCollection->saturationPressurePlotCollection() );
} }
if ( mainPlotCollection->multiPlotCollection() ) if ( mainPlotCollection->multiPlotCollection() )
{ {
itemCollection->add( mainPlotCollection->multiPlotCollection() ); uiTreeOrdering.add( mainPlotCollection->multiPlotCollection() );
} }
if ( mainPlotCollection->stimPlanModelPlotCollection() ) if ( mainPlotCollection->stimPlanModelPlotCollection() )
{ {
itemCollection->add( mainPlotCollection->stimPlanModelPlotCollection() ); uiTreeOrdering.add( mainPlotCollection->stimPlanModelPlotCollection() );
} }
if ( mainPlotCollection->vfpPlotCollection() ) if ( mainPlotCollection->vfpPlotCollection() )
{ {
itemCollection->add( mainPlotCollection->vfpPlotCollection() ); uiTreeOrdering.add( mainPlotCollection->vfpPlotCollection() );
} }
#ifdef USE_QTCHARTS #ifdef USE_QTCHARTS
if ( mainPlotCollection->gridStatisticsPlotCollection() || if ( mainPlotCollection->gridStatisticsPlotCollection() ||
mainPlotCollection->ensembleFractureStatisticsPlotCollection() ) mainPlotCollection->ensembleFractureStatisticsPlotCollection() )
{ {
auto statisticsItemCollection = itemCollection->add( "Statistics Plots", ":/Folder.png" ); auto statisticsItemCollection = uiTreeOrdering.add( "Statistics Plots", ":/Folder.png" );
if ( mainPlotCollection->gridStatisticsPlotCollection() ) if ( mainPlotCollection->gridStatisticsPlotCollection() )
statisticsItemCollection->add( mainPlotCollection->gridStatisticsPlotCollection() ); statisticsItemCollection->add( mainPlotCollection->gridStatisticsPlotCollection() );
@ -1490,7 +1458,28 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q
} }
#endif #endif
} }
}
else if ( uiConfigName == "PlotWindow.DataSources" )
{
RimOilField* oilField = activeOilField();
if ( oilField )
{
if ( oilField->summaryCaseMainCollection() )
{
uiTreeOrdering.add( oilField->summaryCaseMainCollection() );
}
if ( oilField->observedDataCollection() )
{
uiTreeOrdering.add( oilField->observedDataCollection() );
}
if ( oilField->ensembleWellLogsCollection() )
{
uiTreeOrdering.add( oilField->ensembleWellLogsCollection() );
}
}
}
else if ( uiConfigName == "PlotWindow.Scripts" )
{
uiTreeOrdering.add( scriptCollection() ); uiTreeOrdering.add( scriptCollection() );
} }
else else

View File

@ -103,11 +103,11 @@ public:
caf::PdmChildArrayField<RimAdvancedSnapshotExportDefinition*> multiSnapshotDefinitions; caf::PdmChildArrayField<RimAdvancedSnapshotExportDefinition*> multiSnapshotDefinitions;
caf::PdmField<QString> mainWindowTreeViewState; caf::PdmField<QString> mainWindowTreeViewStates;
caf::PdmField<QString> mainWindowCurrentModelIndexPath; caf::PdmField<QString> mainWindowCurrentModelIndexPaths;
caf::PdmField<QString> plotWindowTreeViewState; caf::PdmField<QString> plotWindowTreeViewStates;
caf::PdmField<QString> plotWindowCurrentModelIndexPath; caf::PdmField<QString> plotWindowCurrentModelIndexPaths;
bool writeProjectFile(); bool writeProjectFile();

View File

@ -111,9 +111,25 @@ QString RiuDockWidgetTools::summaryPlotManagerName()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RiuDockWidgetTools::plotMainWindowProjectTreeName() QString RiuDockWidgetTools::plotMainWindowDataSourceTreeName()
{ {
return "plotMainWindow_dockProjectTree"; return "plotMainWindow_dockDataSourceTree";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiuDockWidgetTools::plotMainWindowPlotsTreeName()
{
return "plotMainWindow_dockPlotsTree";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiuDockWidgetTools::plotMainWindowScriptsTreeName()
{
return "plotMainWindow_dockScriptsTree";
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -48,7 +48,10 @@ public:
static QString undoStackName(); static QString undoStackName();
static QString summaryPlotManagerName(); static QString summaryPlotManagerName();
static QString plotMainWindowProjectTreeName(); static QString plotMainWindowDataSourceTreeName();
static QString plotMainWindowPlotsTreeName();
static QString plotMainWindowScriptsTreeName();
static QString plotMainWindowPropertyEditorName(); static QString plotMainWindowPropertyEditorName();
static QString plotMainWindowMessagesName(); static QString plotMainWindowMessagesName();
static QString plotMainWindowUndoStackName(); static QString plotMainWindowUndoStackName();

View File

@ -172,9 +172,10 @@ private:
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiuDragDrop::RiuDragDrop() RiuDragDrop::RiuDragDrop( caf::PdmUiTreeView* treeView )
: m_projectTreeView( treeView )
, m_proposedDropAction( Qt::MoveAction )
{ {
m_proposedDropAction = Qt::MoveAction;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -237,8 +238,7 @@ Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const
if ( index.isValid() && RiaGuiApplication::activeMainWindow() ) if ( index.isValid() && RiaGuiApplication::activeMainWindow() )
{ {
caf::PdmUiTreeView* uiTreeView = RiaGuiApplication::activeMainWindow()->projectTreeView(); caf::PdmUiItem* uiItem = m_projectTreeView->uiItemFromModelIndex( index );
caf::PdmUiItem* uiItem = uiTreeView->uiItemFromModelIndex( index );
caf::PdmObject* pdmObj = dynamic_cast<caf::PdmObject*>( uiItem ); caf::PdmObject* pdmObj = dynamic_cast<caf::PdmObject*>( uiItem );
if ( pdmObj ) if ( pdmObj )
@ -361,7 +361,8 @@ Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const
bool RiuDragDrop::dropMimeData( const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& dropTargetIndex ) bool RiuDragDrop::dropMimeData( const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& dropTargetIndex )
{ {
CVF_ASSERT( RiaGuiApplication::activeMainWindow() ); CVF_ASSERT( RiaGuiApplication::activeMainWindow() );
caf::PdmUiTreeView* uiTreeView = RiaGuiApplication::activeMainWindow()->projectTreeView();
caf::PdmUiTreeView* uiTreeView = m_projectTreeView;
caf::PdmUiItem* dropTargetUiItem = uiTreeView->uiItemFromModelIndex( dropTargetIndex ); caf::PdmUiItem* dropTargetUiItem = uiTreeView->uiItemFromModelIndex( dropTargetIndex );
caf::PdmObjectHandle* dropTarget = dynamic_cast<caf::PdmObjectHandle*>( dropTargetUiItem ); caf::PdmObjectHandle* dropTarget = dynamic_cast<caf::PdmObjectHandle*>( dropTargetUiItem );

View File

@ -47,7 +47,7 @@ class RimWellLogCurve;
class RiuDragDrop : public caf::PdmUiDragDropInterface class RiuDragDrop : public caf::PdmUiDragDropInterface
{ {
public: public:
RiuDragDrop(); RiuDragDrop( caf::PdmUiTreeView* treeView );
~RiuDragDrop() override; ~RiuDragDrop() override;
static std::vector<caf::PdmObjectHandle*> draggedObjectsFromTreeView( caf::PdmUiTreeView* dragSource, static std::vector<caf::PdmObjectHandle*> draggedObjectsFromTreeView( caf::PdmUiTreeView* dragSource,
@ -107,5 +107,7 @@ private:
private: private:
mutable std::vector<caf::PdmPointer<caf::PdmObjectHandle>> m_dragItems; mutable std::vector<caf::PdmPointer<caf::PdmObjectHandle>> m_dragItems;
Qt::DropAction m_proposedDropAction;
Qt::DropAction m_proposedDropAction;
caf::PdmUiTreeView* m_projectTreeView;
}; };

View File

@ -48,7 +48,6 @@
#include "RimViewWindow.h" #include "RimViewWindow.h"
#include "RiuDockWidgetTools.h" #include "RiuDockWidgetTools.h"
#include "RiuDragDrop.h"
#include "RiuMdiSubWindow.h" #include "RiuMdiSubWindow.h"
#include "RiuMessagePanel.h" #include "RiuMessagePanel.h"
#include "RiuMohrsCirclePlot.h" #include "RiuMohrsCirclePlot.h"
@ -70,7 +69,6 @@
#include "cafPdmUiPropertyView.h" #include "cafPdmUiPropertyView.h"
#include "cafPdmUiPropertyViewDialog.h" #include "cafPdmUiPropertyViewDialog.h"
#include "cafPdmUiTreeView.h" #include "cafPdmUiTreeView.h"
#include "cafQTreeViewStateSerializer.h"
#include "cafSelectionManager.h" #include "cafSelectionManager.h"
#include "cafUtils.h" #include "cafUtils.h"
@ -132,8 +130,6 @@ RiuMainWindow::RiuMainWindow()
createToolBars(); createToolBars();
createDockPanels(); createDockPanels();
m_dragDropInterface = std::unique_ptr<caf::PdmUiDragDropInterface>( new RiuDragDrop() );
if ( m_undoView ) if ( m_undoView )
{ {
m_undoView->setStack( caf::CmdExecCommandManager::instance()->undoStack() ); m_undoView->setStack( caf::CmdExecCommandManager::instance()->undoStack() );
@ -710,36 +706,40 @@ void RiuMainWindow::createToolBars()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuMainWindow::createDockPanels() void RiuMainWindow::createDockPanels()
{ {
const int nTreeViews = 1;
createTreeViews( nTreeViews );
{ {
QDockWidget* dockWidget = new QDockWidget( "Project Tree", this ); QDockWidget* dockWidget = new QDockWidget( "Project Tree", this );
dockWidget->setObjectName( RiuDockWidgetTools::projectTreeName() ); dockWidget->setObjectName( RiuDockWidgetTools::projectTreeName() );
dockWidget->setAllowedAreas( Qt::AllDockWidgetAreas ); dockWidget->setAllowedAreas( Qt::AllDockWidgetAreas );
m_projectTreeView = new caf::PdmUiTreeView( this ); caf::PdmUiTreeView* projectTree = projectTreeView( 0 );
m_projectTreeView->enableSelectionManagerUpdating( true ); projectTree->enableSelectionManagerUpdating( true );
m_projectTreeView->enableAppendOfClassNameToUiItemText( RiaPreferencesSystem::current()->appendClassNameToUiText() ); projectTree->enableAppendOfClassNameToUiItemText( RiaPreferencesSystem::current()->appendClassNameToUiText() );
dockWidget->setWidget( m_projectTreeView ); dockWidget->setWidget( projectTree );
m_projectTreeView->treeView()->setHeaderHidden( true ); projectTree->treeView()->setHeaderHidden( true );
m_projectTreeView->treeView()->setSelectionMode( QAbstractItemView::ExtendedSelection ); projectTree->treeView()->setSelectionMode( QAbstractItemView::ExtendedSelection );
// Drag and drop configuration // Drag and drop configuration
m_projectTreeView->treeView()->setDragEnabled( true ); projectTree->treeView()->setDragEnabled( true );
m_projectTreeView->treeView()->viewport()->setAcceptDrops( true ); projectTree->treeView()->viewport()->setAcceptDrops( true );
m_projectTreeView->treeView()->setDropIndicatorShown( true ); projectTree->treeView()->setDropIndicatorShown( true );
m_projectTreeView->treeView()->setDragDropMode( QAbstractItemView::DragDrop ); projectTree->treeView()->setDragDropMode( QAbstractItemView::DragDrop );
// Install event filter used to handle key press events // Install event filter used to handle key press events
RiuTreeViewEventFilter* treeViewEventFilter = new RiuTreeViewEventFilter( this ); RiuTreeViewEventFilter* treeViewEventFilter = new RiuTreeViewEventFilter( this, projectTree );
m_projectTreeView->treeView()->installEventFilter( treeViewEventFilter ); projectTree->treeView()->installEventFilter( treeViewEventFilter );
addDockWidget( Qt::LeftDockWidgetArea, dockWidget ); addDockWidget( Qt::LeftDockWidgetArea, dockWidget );
connect( m_projectTreeView, SIGNAL( selectionChanged() ), this, SLOT( selectedObjectsChanged() ) ); connect( projectTree, SIGNAL( selectionChanged() ), this, SLOT( selectedObjectsChanged() ) );
m_projectTreeView->treeView()->setContextMenuPolicy( Qt::CustomContextMenu ); projectTree->treeView()->setContextMenuPolicy( Qt::CustomContextMenu );
connect( m_projectTreeView->treeView(), connect( projectTree->treeView(),
SIGNAL( customContextMenuRequested( const QPoint& ) ), SIGNAL( customContextMenuRequested( const QPoint& ) ),
SLOT( customMenuRequested( const QPoint& ) ) ); SLOT( customMenuRequested( const QPoint& ) ) );
} }
@ -1173,9 +1173,10 @@ void RiuMainWindow::setPdmRoot( caf::PdmObject* pdmRoot )
{ {
m_pdmRoot = pdmRoot; m_pdmRoot = pdmRoot;
m_projectTreeView->setPdmItem( pdmRoot ); for ( auto tv : projectTreeViews() )
// For debug only : m_projectTreeView->treeView()->expandAll(); {
m_projectTreeView->setDragDropInterface( m_dragDropInterface.get() ); tv->setPdmItem( pdmRoot );
}
for ( auto& additionalProjectView : m_additionalProjectViews ) for ( auto& additionalProjectView : m_additionalProjectViews )
{ {
@ -1301,15 +1302,15 @@ void RiuMainWindow::selectViewInProjectTreePreservingSubItemSelection( const Rim
if ( is3dViewCurrentlySelected && ( previousActiveReservoirView != activatedView ) ) if ( is3dViewCurrentlySelected && ( previousActiveReservoirView != activatedView ) )
{ {
QModelIndex newViewModelIndex = m_projectTreeView->findModelIndex( activatedView ); QModelIndex newViewModelIndex = projectTreeView( 0 )->findModelIndex( activatedView );
QModelIndex newSelectionIndex = newViewModelIndex; QModelIndex newSelectionIndex = newViewModelIndex;
if ( previousActiveReservoirView && is3dViewCurrentlySelected ) if ( previousActiveReservoirView && is3dViewCurrentlySelected )
{ {
// Try to select the same entry in the new View, as was selected in the previous // Try to select the same entry in the new View, as was selected in the previous
QModelIndex previousViewModelIndex = m_projectTreeView->findModelIndex( previousActiveReservoirView ); QModelIndex previousViewModelIndex = projectTreeView( 0 )->findModelIndex( previousActiveReservoirView );
QModelIndex currentSelectionIndex = m_projectTreeView->treeView()->selectionModel()->currentIndex(); QModelIndex currentSelectionIndex = projectTreeView( 0 )->treeView()->selectionModel()->currentIndex();
if ( currentSelectionIndex != newViewModelIndex && currentSelectionIndex.isValid() ) if ( currentSelectionIndex != newViewModelIndex && currentSelectionIndex.isValid() )
{ {
@ -1333,7 +1334,7 @@ void RiuMainWindow::selectViewInProjectTreePreservingSubItemSelection( const Rim
if ( newSelectionIndex.isValid() ) if ( newSelectionIndex.isValid() )
{ {
newSelectionIndex = newSelectionIndex =
m_projectTreeView->treeView()->model()->index( tmp.row(), tmp.column(), newSelectionIndex ); projectTreeView( 0 )->treeView()->model()->index( tmp.row(), tmp.column(), newSelectionIndex );
} }
} }
@ -1345,10 +1346,10 @@ void RiuMainWindow::selectViewInProjectTreePreservingSubItemSelection( const Rim
} }
} }
m_projectTreeView->treeView()->setCurrentIndex( newSelectionIndex ); projectTreeView( 0 )->treeView()->setCurrentIndex( newSelectionIndex );
if ( newSelectionIndex != newViewModelIndex ) if ( newSelectionIndex != newViewModelIndex )
{ {
m_projectTreeView->treeView()->setExpanded( newViewModelIndex, true ); projectTreeView( 0 )->treeView()->setExpanded( newViewModelIndex, true );
} }
} }
} }
@ -1441,7 +1442,7 @@ void RiuMainWindow::slotBuildWindowActions()
void RiuMainWindow::selectedObjectsChanged() void RiuMainWindow::selectedObjectsChanged()
{ {
std::vector<caf::PdmUiItem*> uiItems; std::vector<caf::PdmUiItem*> uiItems;
m_projectTreeView->selectedUiItems( uiItems ); projectTreeView( 0 )->selectedUiItems( uiItems );
caf::PdmObjectHandle* firstSelectedObject = nullptr; caf::PdmObjectHandle* firstSelectedObject = nullptr;
if ( !uiItems.empty() ) if ( !uiItems.empty() )
@ -1499,7 +1500,7 @@ void RiuMainWindow::selectedObjectsChanged()
// The only way to get to this code is by selection change initiated from the project tree view // The only way to get to this code is by selection change initiated from the project tree view
// As we are activating an MDI-window, the focus is given to this MDI-window // As we are activating an MDI-window, the focus is given to this MDI-window
// Set focus back to the tree view to be able to continue keyboard tree view navigation // Set focus back to the tree view to be able to continue keyboard tree view navigation
m_projectTreeView->treeView()->setFocus(); projectTreeView( 0 )->treeView()->setFocus();
} }
} }
} }
@ -1687,24 +1688,8 @@ void RiuMainWindow::slotToggleLightingAction( bool enable )
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuMainWindow::restoreTreeViewState() void RiuMainWindow::restoreTreeViewState()
{ {
if ( m_projectTreeView ) restoreTreeViewStates( RimProject::current()->mainWindowTreeViewStates(),
{ RimProject::current()->mainWindowCurrentModelIndexPaths() );
QString stateString = RimProject::current()->mainWindowTreeViewState;
if ( !stateString.isEmpty() )
{
m_projectTreeView->treeView()->collapseAll();
caf::QTreeViewStateSerializer::applyTreeViewStateFromString( m_projectTreeView->treeView(), stateString );
}
QString currentIndexString = RimProject::current()->mainWindowCurrentModelIndexPath;
if ( !currentIndexString.isEmpty() )
{
QModelIndex mi =
caf::QTreeViewStateSerializer::getModelIndexFromString( m_projectTreeView->treeView()->model(),
currentIndexString );
m_projectTreeView->treeView()->setCurrentIndex( mi );
}
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -1879,7 +1864,7 @@ void RiuMainWindow::slotCreateCommandObject()
if ( !app->project() ) return; if ( !app->project() ) return;
std::vector<caf::PdmUiItem*> selectedUiItems; std::vector<caf::PdmUiItem*> selectedUiItems;
m_projectTreeView->selectedUiItems( selectedUiItems ); projectTreeView( 0 )->selectedUiItems( selectedUiItems );
caf::PdmObjectGroup selectedObjects; caf::PdmObjectGroup selectedObjects;
for ( auto* selectedUiItem : selectedUiItems ) for ( auto* selectedUiItem : selectedUiItems )

View File

@ -24,7 +24,6 @@
#include "RiuMdiArea.h" #include "RiuMdiArea.h"
#include "cafPdmObjectHandle.h" #include "cafPdmObjectHandle.h"
#include "cafPdmUiDragDropInterface.h"
#include <QEvent> #include <QEvent>
#include <QLabel> #include <QLabel>
@ -247,8 +246,6 @@ public:
void setPdmRoot( caf::PdmObject* pdmRoot ); void setPdmRoot( caf::PdmObject* pdmRoot );
private: private:
std::unique_ptr<caf::PdmUiDragDropInterface> m_dragDropInterface;
caf::PdmObject* m_pdmRoot; caf::PdmObject* m_pdmRoot;
caf::PdmUiPropertyView* m_pdmUiPropertyView; caf::PdmUiPropertyView* m_pdmUiPropertyView;

View File

@ -19,25 +19,28 @@
#include "RiuMainWindowBase.h" #include "RiuMainWindowBase.h"
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RiaDefines.h"
#include "RiaPreferences.h" #include "RiaPreferences.h"
#include "RiaVersionInfo.h" #include "RiaVersionInfo.h"
#include "RiuDockWidgetTools.h" #include "RiuDockWidgetTools.h"
#include "RiuDragDrop.h"
#include "RiuMdiSubWindow.h" #include "RiuMdiSubWindow.h"
#include "RimProject.h" #include "RimProject.h"
#include "RimViewWindow.h" #include "RimViewWindow.h"
#include "cafCmdFeatureManager.h"
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cafPdmUiTreeView.h" #include "cafPdmUiTreeView.h"
#include "cafQTreeViewStateSerializer.h"
#include "cafCmdFeatureManager.h"
#include <QAction> #include <QAction>
#include <QDockWidget> #include <QDockWidget>
#include <QMdiArea> #include <QMdiArea>
#include <QMdiSubWindow> #include <QMdiSubWindow>
#include <QSettings> #include <QSettings>
#include <QTreeView>
#include <QUndoStack> #include <QUndoStack>
#include <QUndoView> #include <QUndoView>
@ -45,8 +48,7 @@
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiuMainWindowBase::RiuMainWindowBase() RiuMainWindowBase::RiuMainWindowBase()
: m_projectTreeView( nullptr ) : m_allowActiveViewChangeFromSelection( true )
, m_allowActiveViewChangeFromSelection( true )
, m_showFirstVisibleWindowMaximized( true ) , m_showFirstVisibleWindowMaximized( true )
, m_blockSubWindowActivation( false ) , m_blockSubWindowActivation( false )
, m_blockSubWindowProjectTreeSelection( false ) , m_blockSubWindowProjectTreeSelection( false )
@ -238,7 +240,10 @@ QString RiuMainWindowBase::registryFolderName()
void RiuMainWindowBase::selectAsCurrentItem( const caf::PdmObject* object, bool allowActiveViewChange ) void RiuMainWindowBase::selectAsCurrentItem( const caf::PdmObject* object, bool allowActiveViewChange )
{ {
m_allowActiveViewChangeFromSelection = allowActiveViewChange; m_allowActiveViewChangeFromSelection = allowActiveViewChange;
m_projectTreeView->selectAsCurrentItem( object );
auto tv = getTreeViewWithItem( object );
if ( tv ) tv->selectAsCurrentItem( object );
m_allowActiveViewChangeFromSelection = true; m_allowActiveViewChangeFromSelection = true;
} }
@ -247,11 +252,15 @@ void RiuMainWindowBase::selectAsCurrentItem( const caf::PdmObject* object, bool
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuMainWindowBase::toggleItemInSelection( const caf::PdmObject* object, bool allowActiveViewChange ) void RiuMainWindowBase::toggleItemInSelection( const caf::PdmObject* object, bool allowActiveViewChange )
{ {
auto tv = getTreeViewWithItem( object );
if ( !tv ) return;
m_allowActiveViewChangeFromSelection = allowActiveViewChange; m_allowActiveViewChangeFromSelection = allowActiveViewChange;
std::vector<caf::PdmUiItem*> currentSelection; std::vector<caf::PdmUiItem*> currentSelection;
m_projectTreeView->selectedUiItems( currentSelection ); tv->selectedUiItems( currentSelection );
std::vector<const caf::PdmUiItem*> updatedSelection; std::vector<const caf::PdmUiItem*> updatedSelection;
bool alreadySelected = false;
bool alreadySelected = false;
for ( caf::PdmUiItem* uiItem : currentSelection ) for ( caf::PdmUiItem* uiItem : currentSelection )
{ {
if ( object == uiItem ) if ( object == uiItem )
@ -267,7 +276,7 @@ void RiuMainWindowBase::toggleItemInSelection( const caf::PdmObject* object, boo
{ {
updatedSelection.push_back( object ); updatedSelection.push_back( object );
} }
m_projectTreeView->selectItems( updatedSelection ); tv->selectItems( updatedSelection );
m_allowActiveViewChangeFromSelection = true; m_allowActiveViewChangeFromSelection = true;
} }
@ -364,7 +373,8 @@ void RiuMainWindowBase::removeViewerFromMdiArea( QMdiArea* mdiArea, QWidget* vie
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuMainWindowBase::setExpanded( const caf::PdmUiItem* uiItem, bool expanded ) void RiuMainWindowBase::setExpanded( const caf::PdmUiItem* uiItem, bool expanded )
{ {
m_projectTreeView->setExpanded( uiItem, expanded ); caf::PdmUiTreeView* tv = getTreeViewWithItem( uiItem );
if ( tv ) tv->setExpanded( uiItem, expanded );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -470,3 +480,88 @@ void RiuMainWindowBase::slotRefreshUndoRedoActions()
m_redoAction->setDisabled( !m_undoView->stack()->canRedo() ); m_redoAction->setDisabled( !m_undoView->stack()->canRedo() );
m_undoAction->setDisabled( !m_undoView->stack()->canUndo() ); m_undoAction->setDisabled( !m_undoView->stack()->canUndo() );
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMainWindowBase::createTreeViews( int numberOfTrees )
{
CVF_ASSERT( m_projectTreeViews.empty() );
for ( int i = 0; i < numberOfTrees; i++ )
{
auto tv = new caf::PdmUiTreeView();
caf::PdmUiDragDropInterface* dragDropInterface = new RiuDragDrop( tv );
tv->setDragDropInterface( dragDropInterface );
m_projectTreeViews.push_back( tv );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmUiTreeView* RiuMainWindowBase::projectTreeView( int treeId )
{
CVF_ASSERT( treeId >= 0 );
CVF_ASSERT( treeId < (int)m_projectTreeViews.size() );
return m_projectTreeViews[treeId];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmUiTreeView* RiuMainWindowBase::getTreeViewWithItem( const caf::PdmUiItem* uiItem )
{
for ( auto tv : m_projectTreeViews )
{
QModelIndex qmi = tv->findModelIndex( uiItem );
if ( qmi.isValid() )
{
return tv;
}
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<caf::PdmUiTreeView*> RiuMainWindowBase::projectTreeViews()
{
return m_projectTreeViews;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMainWindowBase::restoreTreeViewStates( QString treeStateString, QString treeIndexeString )
{
QStringList treeStates = treeStateString.split( RiaDefines::stringListSeparator() );
QStringList treeIndexes = treeIndexeString.split( RiaDefines::stringListSeparator() );
const int nTreeViews = (int)projectTreeViews().size();
if ( treeStates.size() < nTreeViews ) return;
if ( treeIndexes.size() < nTreeViews ) return;
for ( int treeId = 0; treeId < nTreeViews; treeId++ )
{
auto tv = projectTreeView( treeId );
QString stateString = treeStates[treeId];
if ( !stateString.isEmpty() )
{
tv->treeView()->collapseAll();
caf::QTreeViewStateSerializer::applyTreeViewStateFromString( tv->treeView(), stateString );
}
QString currentIndexString = treeIndexes[treeId];
if ( !currentIndexString.isEmpty() )
{
QModelIndex mi =
caf::QTreeViewStateSerializer::getModelIndexFromString( tv->treeView()->model(), currentIndexString );
tv->treeView()->setCurrentIndex( mi );
}
}
}

View File

@ -20,6 +20,11 @@
#include <QMainWindow> #include <QMainWindow>
#include "cafPdmUiDragDropInterface.h"
#include <memory>
#include <vector>
class QMdiArea; class QMdiArea;
struct RimMdiWindowGeometry; struct RimMdiWindowGeometry;
@ -65,8 +70,11 @@ public:
void hideAllDockWidgets(); void hideAllDockWidgets();
caf::PdmUiTreeView* projectTreeView() { return m_projectTreeView; } std::vector<caf::PdmUiTreeView*> projectTreeViews();
void setExpanded( const caf::PdmUiItem* uiItem, bool expanded = true ); caf::PdmUiTreeView* projectTreeView( int treeId );
caf::PdmUiTreeView* getTreeViewWithItem( const caf::PdmUiItem* item );
void setExpanded( const caf::PdmUiItem* uiItem, bool expanded = true );
void selectAsCurrentItem( const caf::PdmObject* object, bool allowActiveViewChange = true ); void selectAsCurrentItem( const caf::PdmObject* object, bool allowActiveViewChange = true );
void toggleItemInSelection( const caf::PdmObject* object, bool allowActiveViewChange = true ); void toggleItemInSelection( const caf::PdmObject* object, bool allowActiveViewChange = true );
@ -85,12 +93,15 @@ public:
bool isBlockingViewSelectionOnSubWindowActivated() const; bool isBlockingViewSelectionOnSubWindowActivated() const;
protected: protected:
void createTreeViews( int numberOfTrees );
void removeViewerFromMdiArea( QMdiArea* mdiArea, QWidget* viewer ); void removeViewerFromMdiArea( QMdiArea* mdiArea, QWidget* viewer );
void initializeSubWindow( QMdiArea* mdiArea, void initializeSubWindow( QMdiArea* mdiArea,
QMdiSubWindow* mdiSubWindow, QMdiSubWindow* mdiSubWindow,
const QPoint& subWindowPos, const QPoint& subWindowPos,
const QSize& subWindowSize ); const QSize& subWindowSize );
void restoreTreeViewStates( QString treeStateString, QString treeIndexString );
protected slots: protected slots:
void slotDockWidgetToggleViewActionTriggered(); void slotDockWidgetToggleViewActionTriggered();
void slotRefreshHelpActions(); void slotRefreshHelpActions();
@ -100,8 +111,7 @@ protected slots:
void slotRefreshUndoRedoActions(); void slotRefreshUndoRedoActions();
protected: protected:
caf::PdmUiTreeView* m_projectTreeView; bool m_allowActiveViewChangeFromSelection; // To be used in selectedObjectsChanged() to control
bool m_allowActiveViewChangeFromSelection; // To be used in selectedObjectsChanged() to control
// whether to select the corresponding active view or not // whether to select the corresponding active view or not
QAction* m_undoAction; QAction* m_undoAction;
@ -112,6 +122,9 @@ private:
QString registryFolderName(); QString registryFolderName();
private: private:
std::vector<caf::PdmUiTreeView*> m_projectTreeViews;
std::vector<std::unique_ptr<caf::PdmUiDragDropInterface>> m_dragDropInterfaces;
bool m_showFirstVisibleWindowMaximized; bool m_showFirstVisibleWindowMaximized;
bool m_blockSubWindowActivation; bool m_blockSubWindowActivation;
bool m_blockSubWindowProjectTreeSelection; bool m_blockSubWindowProjectTreeSelection;

View File

@ -37,6 +37,7 @@
#include <QMainWindow> #include <QMainWindow>
#include <QMdiSubWindow> #include <QMdiSubWindow>
#include <QModelIndex>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -47,49 +48,38 @@ void RiuMainWindowTools::collapseSiblings( const caf::PdmUiItem* sourceUiItem )
if ( !RiaGuiApplication::isRunning() ) return; if ( !RiaGuiApplication::isRunning() ) return;
caf::PdmUiTreeView* sourceTreeView = nullptr;
if ( RiuMainWindow::instance() )
{ {
caf::PdmUiTreeView* sourceTreeView = nullptr; sourceTreeView = RiuMainWindow::instance()->getTreeViewWithItem( sourceUiItem );
caf::PdmUiTreeOrdering* sourceTreeOrderingItem = nullptr; }
if ( !sourceTreeView )
{
RiuPlotMainWindow* mpw = RiaGuiApplication::instance()->mainPlotWindow();
if ( mpw )
{ {
QModelIndex modIndex; sourceTreeView = mpw->getTreeViewWithItem( sourceUiItem );
if ( RiuMainWindow::instance() )
{
modIndex = RiuMainWindow::instance()->projectTreeView()->findModelIndex( sourceUiItem );
}
if ( modIndex.isValid() )
{
sourceTreeView = RiuMainWindow::instance()->projectTreeView();
}
else
{
RiuPlotMainWindow* mpw = RiaGuiApplication::instance()->mainPlotWindow();
if ( mpw )
{
modIndex = mpw->projectTreeView()->findModelIndex( sourceUiItem );
if ( modIndex.isValid() )
{
sourceTreeView = mpw->projectTreeView();
}
}
}
if ( !modIndex.isValid() ) return;
sourceTreeOrderingItem = static_cast<caf::PdmUiTreeOrdering*>( modIndex.internalPointer() );
} }
}
if ( sourceTreeView && sourceTreeOrderingItem && sourceTreeOrderingItem->parent() ) if ( !sourceTreeView ) return;
caf::PdmUiTreeOrdering* sourceTreeOrderingItem = nullptr;
QModelIndex modIndex = sourceTreeView->findModelIndex( sourceUiItem );
if ( !modIndex.isValid() ) return;
sourceTreeOrderingItem = static_cast<caf::PdmUiTreeOrdering*>( modIndex.internalPointer() );
if ( sourceTreeOrderingItem && sourceTreeOrderingItem->parent() )
{
for ( int i = 0; i < sourceTreeOrderingItem->parent()->childCount(); i++ )
{ {
for ( int i = 0; i < sourceTreeOrderingItem->parent()->childCount(); i++ ) auto siblingTreeOrderingItem = sourceTreeOrderingItem->parent()->child( i );
if ( siblingTreeOrderingItem != sourceTreeOrderingItem )
{ {
auto siblingTreeOrderingItem = sourceTreeOrderingItem->parent()->child( i ); sourceTreeView->setExpanded( siblingTreeOrderingItem->activeItem(), false );
if ( siblingTreeOrderingItem != sourceTreeOrderingItem )
{
sourceTreeView->setExpanded( siblingTreeOrderingItem->activeItem(), false );
}
} }
} }
} }

View File

@ -45,7 +45,6 @@
#include "SummaryPlotCommands/RicSummaryPlotEditorDialog.h" #include "SummaryPlotCommands/RicSummaryPlotEditorDialog.h"
#include "RiuDockWidgetTools.h" #include "RiuDockWidgetTools.h"
#include "RiuDragDrop.h"
#include "RiuMdiSubWindow.h" #include "RiuMdiSubWindow.h"
#include "RiuMessagePanel.h" #include "RiuMessagePanel.h"
#include "RiuMultiPlotPage.h" #include "RiuMultiPlotPage.h"
@ -59,7 +58,6 @@
#include "cafPdmUiPropertyView.h" #include "cafPdmUiPropertyView.h"
#include "cafPdmUiToolBarEditor.h" #include "cafPdmUiToolBarEditor.h"
#include "cafPdmUiTreeView.h" #include "cafPdmUiTreeView.h"
#include "cafQTreeViewStateSerializer.h"
#include "cafSelectionManager.h" #include "cafSelectionManager.h"
#include <QCloseEvent> #include <QCloseEvent>
@ -90,8 +88,6 @@ RiuPlotMainWindow::RiuPlotMainWindow()
// Store the layout so we can offer reset option // Store the layout so we can offer reset option
m_initialDockAndToolbarLayout = saveState( 0 ); m_initialDockAndToolbarLayout = saveState( 0 );
m_dragDropInterface = std::unique_ptr<caf::PdmUiDragDropInterface>( new RiuDragDrop() );
if ( m_undoView ) if ( m_undoView )
{ {
m_undoView->setStack( caf::CmdExecCommandManager::instance()->undoStack() ); m_undoView->setStack( caf::CmdExecCommandManager::instance()->undoStack() );
@ -455,40 +451,64 @@ void RiuPlotMainWindow::refreshToolbars()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::createDockPanels() void RiuPlotMainWindow::createDockPanels()
{ {
const int nTreeViews = 3;
const std::vector<QString> treeViewTitles = { "Plots", "Data Sources", "Scripts" };
const std::vector<QString> treeViewConfigs = { "PlotWindow.Plots", "PlotWindow.DataSources", "PlotWindow.Scripts" };
const std::vector<QString> treeViewDockNames = { RiuDockWidgetTools::plotMainWindowPlotsTreeName(),
RiuDockWidgetTools::plotMainWindowDataSourceTreeName(),
RiuDockWidgetTools::plotMainWindowScriptsTreeName() };
createTreeViews( nTreeViews );
QDockWidget* dockOntopOfWidget = nullptr;
for ( int i = 0; i < nTreeViews; i++ )
{ {
QDockWidget* dockWidget = new QDockWidget( "Plot Project Tree", this ); QDockWidget* dockWidget = new QDockWidget( treeViewTitles[i], this );
dockWidget->setObjectName( RiuDockWidgetTools::plotMainWindowProjectTreeName() ); dockWidget->setObjectName( treeViewDockNames[i] );
dockWidget->setAllowedAreas( Qt::AllDockWidgetAreas ); dockWidget->setAllowedAreas( Qt::AllDockWidgetAreas );
m_projectTreeView = new caf::PdmUiTreeView( this ); caf::PdmUiTreeView* projectTree = projectTreeView( i );
m_projectTreeView->enableSelectionManagerUpdating( true ); projectTree->enableSelectionManagerUpdating( true );
m_projectTreeView->enableAppendOfClassNameToUiItemText( RiaPreferencesSystem::current()->appendClassNameToUiText() ); projectTree->enableAppendOfClassNameToUiItemText( RiaPreferencesSystem::current()->appendClassNameToUiText() );
dockWidget->setWidget( m_projectTreeView ); dockWidget->setWidget( projectTree );
m_projectTreeView->treeView()->setHeaderHidden( true ); projectTree->treeView()->setHeaderHidden( true );
m_projectTreeView->treeView()->setSelectionMode( QAbstractItemView::ExtendedSelection ); projectTree->treeView()->setSelectionMode( QAbstractItemView::ExtendedSelection );
// Drag and drop configuration // Drag and drop configuration
m_projectTreeView->treeView()->setDragEnabled( true ); projectTree->treeView()->setDragEnabled( true );
m_projectTreeView->treeView()->viewport()->setAcceptDrops( true ); projectTree->treeView()->viewport()->setAcceptDrops( true );
m_projectTreeView->treeView()->setDropIndicatorShown( true ); projectTree->treeView()->setDropIndicatorShown( true );
m_projectTreeView->treeView()->setDragDropMode( QAbstractItemView::DragDrop ); projectTree->treeView()->setDragDropMode( QAbstractItemView::DragDrop );
// Install event filter used to handle key press events // Install event filter used to handle key press events
RiuTreeViewEventFilter* treeViewEventFilter = new RiuTreeViewEventFilter( this ); RiuTreeViewEventFilter* treeViewEventFilter = new RiuTreeViewEventFilter( this, projectTree );
m_projectTreeView->treeView()->installEventFilter( treeViewEventFilter ); projectTree->treeView()->installEventFilter( treeViewEventFilter );
addDockWidget( Qt::LeftDockWidgetArea, dockWidget ); addDockWidget( Qt::LeftDockWidgetArea, dockWidget );
connect( m_projectTreeView, SIGNAL( selectionChanged() ), this, SLOT( selectedObjectsChanged() ) ); if ( dockOntopOfWidget )
m_projectTreeView->treeView()->setContextMenuPolicy( Qt::CustomContextMenu ); {
connect( m_projectTreeView->treeView(), tabifyDockWidget( dockOntopOfWidget, dockWidget );
}
else
{
dockOntopOfWidget = dockWidget;
}
connect( dockWidget, SIGNAL( visibilityChanged( bool ) ), projectTree, SLOT( treeVisibilityChanged( bool ) ) );
connect( projectTree, SIGNAL( selectionChanged() ), this, SLOT( selectedObjectsChanged() ) );
projectTree->treeView()->setContextMenuPolicy( Qt::CustomContextMenu );
connect( projectTree->treeView(),
SIGNAL( customContextMenuRequested( const QPoint& ) ), SIGNAL( customContextMenuRequested( const QPoint& ) ),
SLOT( customMenuRequested( const QPoint& ) ) ); SLOT( customMenuRequested( const QPoint& ) ) );
m_projectTreeView->setUiConfigurationName( "PlotWindow" ); projectTree->setUiConfigurationName( treeViewConfigs[i] );
} }
{ {
@ -813,13 +833,14 @@ void RiuPlotMainWindow::initializeViewer( QMdiSubWindow* subWindow, QWidget* vie
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// This method needs to handle memory deallocation !!! ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::setPdmRoot( caf::PdmObject* pdmRoot ) void RiuPlotMainWindow::setPdmRoot( caf::PdmObject* pdmRoot )
{ {
m_projectTreeView->setPdmItem( pdmRoot ); for ( auto tv : projectTreeViews() )
// For debug only : m_projectTreeView->treeView()->expandAll(); {
m_projectTreeView->setDragDropInterface( m_dragDropInterface.get() ); tv->setPdmItem( pdmRoot );
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -836,28 +857,32 @@ void RiuPlotMainWindow::slotSubWindowActivated( QMdiSubWindow* subWindow )
if ( !isBlockingViewSelectionOnSubWindowActivated() ) if ( !isBlockingViewSelectionOnSubWindowActivated() )
{ {
std::vector<caf::PdmUiItem*> currentSelection; caf::PdmUiTreeView* projectTree = getTreeViewWithItem( activatedView );
m_projectTreeView->selectedUiItems( currentSelection ); if ( projectTree )
bool childSelected = false;
for ( caf::PdmUiItem* uiItem : currentSelection )
{ {
caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>( uiItem ); std::vector<caf::PdmUiItem*> currentSelection;
if ( pdmObject ) projectTree->selectedUiItems( currentSelection );
bool childSelected = false;
for ( caf::PdmUiItem* uiItem : currentSelection )
{ {
std::vector<RimViewWindow*> ancestralViews; caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>( uiItem );
pdmObject->allAncestorsOrThisOfType( ancestralViews ); if ( pdmObject )
for ( auto ancestralView : ancestralViews )
{ {
if ( ancestralView == activatedView ) std::vector<RimViewWindow*> ancestralViews;
pdmObject->allAncestorsOrThisOfType( ancestralViews );
for ( auto ancestralView : ancestralViews )
{ {
childSelected = true; if ( ancestralView == activatedView )
{
childSelected = true;
}
} }
} }
} }
} if ( !childSelected )
if ( !childSelected ) {
{ selectAsCurrentItem( activatedView );
selectAsCurrentItem( activatedView ); }
} }
} }
@ -911,8 +936,11 @@ void RiuPlotMainWindow::slotBuildWindowActions()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::selectedObjectsChanged() void RiuPlotMainWindow::selectedObjectsChanged()
{ {
caf::PdmUiTreeView* projectTree = dynamic_cast<caf::PdmUiTreeView*>( sender() );
if ( !projectTree ) return;
std::vector<caf::PdmUiItem*> uiItems; std::vector<caf::PdmUiItem*> uiItems;
m_projectTreeView->selectedUiItems( uiItems ); projectTree->selectedUiItems( uiItems );
caf::PdmObjectHandle* firstSelectedObject = nullptr; caf::PdmObjectHandle* firstSelectedObject = nullptr;
if ( !uiItems.empty() ) if ( !uiItems.empty() )
@ -974,7 +1002,8 @@ void RiuPlotMainWindow::selectedObjectsChanged()
// The only way to get to this code is by selection change initiated from the project tree view // The only way to get to this code is by selection change initiated from the project tree view
// As we are activating an MDI-window, the focus is given to this MDI-window // As we are activating an MDI-window, the focus is given to this MDI-window
// Set focus back to the tree view to be able to continue keyboard tree view navigation // Set focus back to the tree view to be able to continue keyboard tree view navigation
m_projectTreeView->treeView()->setFocus(); projectTree->raise();
projectTree->treeView()->setFocus();
} }
} }
} }
@ -984,24 +1013,8 @@ void RiuPlotMainWindow::selectedObjectsChanged()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::restoreTreeViewState() void RiuPlotMainWindow::restoreTreeViewState()
{ {
if ( m_projectTreeView ) restoreTreeViewStates( RimProject::current()->plotWindowTreeViewStates(),
{ RimProject::current()->plotWindowCurrentModelIndexPaths() );
QString stateString = RimProject::current()->plotWindowTreeViewState;
if ( !stateString.isEmpty() )
{
m_projectTreeView->treeView()->collapseAll();
caf::QTreeViewStateSerializer::applyTreeViewStateFromString( m_projectTreeView->treeView(), stateString );
}
QString currentIndexString = RimProject::current()->plotWindowCurrentModelIndexPath;
if ( !currentIndexString.isEmpty() )
{
QModelIndex mi =
caf::QTreeViewStateSerializer::getModelIndexFromString( m_projectTreeView->treeView()->model(),
currentIndexString );
m_projectTreeView->treeView()->setCurrentIndex( mi );
}
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -22,7 +22,6 @@
#include "RiuMdiArea.h" #include "RiuMdiArea.h"
#include "cafPdmPointer.h" #include "cafPdmPointer.h"
#include "cafPdmUiDragDropInterface.h"
#include <QPointer> #include <QPointer>
@ -133,10 +132,9 @@ private:
QMenu* m_windowMenu; QMenu* m_windowMenu;
caf::PdmUiToolBarEditor* m_wellLogPlotToolBarEditor; caf::PdmUiToolBarEditor* m_wellLogPlotToolBarEditor;
caf::PdmUiToolBarEditor* m_multiPlotToolBarEditor; caf::PdmUiToolBarEditor* m_multiPlotToolBarEditor;
caf::PdmUiToolBarEditor* m_summaryPlotToolBarEditor; caf::PdmUiToolBarEditor* m_summaryPlotToolBarEditor;
std::unique_ptr<caf::PdmUiDragDropInterface> m_dragDropInterface;
caf::PdmUiPropertyView* m_pdmUiPropertyView; caf::PdmUiPropertyView* m_pdmUiPropertyView;
caf::PdmUiPropertyView* m_summaryPlotManagerView; caf::PdmUiPropertyView* m_summaryPlotManagerView;

View File

@ -43,7 +43,7 @@ RiuProjectAndPropertyView::RiuProjectAndPropertyView( QWidget* parent, Qt::Windo
m_projectTreeView->enableSelectionManagerUpdating( true ); m_projectTreeView->enableSelectionManagerUpdating( true );
// Install event filter used to handle key press events // Install event filter used to handle key press events
RiuTreeViewEventFilter* treeViewEventFilter = new RiuTreeViewEventFilter( this ); RiuTreeViewEventFilter* treeViewEventFilter = new RiuTreeViewEventFilter( this, m_projectTreeView );
m_projectTreeView->treeView()->installEventFilter( treeViewEventFilter ); m_projectTreeView->treeView()->installEventFilter( treeViewEventFilter );
// Drag and drop configuration // Drag and drop configuration

View File

@ -44,8 +44,9 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiuTreeViewEventFilter::RiuTreeViewEventFilter( QObject* parent ) RiuTreeViewEventFilter::RiuTreeViewEventFilter( QObject* parent, caf::PdmUiTreeView* treeView )
: QObject( parent ) : QObject( parent )
, m_projectTreeView( treeView )
{ {
} }
@ -141,14 +142,7 @@ bool RiuTreeViewEventFilter::eventFilter( QObject* obj, QEvent* event )
// Do not toggle state if currently editing a name in the tree view // Do not toggle state if currently editing a name in the tree view
bool toggleStateForSelection = true; bool toggleStateForSelection = true;
if ( RiuMainWindow::instance()->projectTreeView() && if ( m_projectTreeView && m_projectTreeView->isTreeItemEditWidgetActive() )
RiuMainWindow::instance()->projectTreeView()->isTreeItemEditWidgetActive() )
{
toggleStateForSelection = false;
}
else if ( RiaGuiApplication::instance()->mainPlotWindow() &&
RiaGuiApplication::instance()->mainPlotWindow()->projectTreeView() &&
RiaGuiApplication::instance()->mainPlotWindow()->projectTreeView()->isTreeItemEditWidgetActive() )
{ {
toggleStateForSelection = false; toggleStateForSelection = false;
} }

View File

@ -29,18 +29,22 @@ class QKeyEvent;
namespace caf namespace caf
{ {
class CmdFeature; class CmdFeature;
} class PdmUiTreeView;
} // namespace caf
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
class RiuTreeViewEventFilter : public QObject class RiuTreeViewEventFilter : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit RiuTreeViewEventFilter( QObject* parent ); explicit RiuTreeViewEventFilter( QObject* parent, caf::PdmUiTreeView* treeView );
static bool activateFeatureFromKeyEvent( QKeyEvent* keyEvent ); static bool activateFeatureFromKeyEvent( QKeyEvent* keyEvent );
static bool activateFirstEnabledFeature( const std::vector<caf::CmdFeature*>& features ); static bool activateFirstEnabledFeature( const std::vector<caf::CmdFeature*>& features );
protected: protected:
bool eventFilter( QObject* obj, QEvent* event ) override; bool eventFilter( QObject* obj, QEvent* event ) override;
private:
caf::PdmUiTreeView* m_projectTreeView;
}; };

View File

@ -769,7 +769,7 @@ void RiuViewerCommands::handlePickAction( int winPosX, int winPosY, Qt::Keyboard
{ {
std::vector<caf::PdmUiItem*> uiItems; std::vector<caf::PdmUiItem*> uiItems;
RiuMainWindow::instance()->projectTreeView()->selectedUiItems( uiItems ); RiuMainWindow::instance()->projectTreeView( 0 )->selectedUiItems( uiItems );
if ( uiItems.size() == 1 ) if ( uiItems.size() == 1 )
{ {

View File

@ -38,6 +38,7 @@
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cafPdmUiDefaultObjectEditor.h" #include "cafPdmUiDefaultObjectEditor.h"
#include "cafPdmUiDragDropInterface.h"
#include "cafPdmUiTreeViewEditor.h" #include "cafPdmUiTreeViewEditor.h"
#include <QHBoxLayout> #include <QHBoxLayout>
@ -228,4 +229,12 @@ void PdmUiTreeView::enableAppendOfClassNameToUiItemText( bool enable )
m_treeViewEditor->enableAppendOfClassNameToUiItemText( enable ); m_treeViewEditor->enableAppendOfClassNameToUiItemText( enable );
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void PdmUiTreeView::treeVisibilityChanged( bool visible )
{
if ( visible ) slotOnSelectionChanged();
}
} // End of namespace caf } // End of namespace caf

View File

@ -38,6 +38,8 @@
#include <QString> #include <QString>
#include <QWidget> #include <QWidget>
#include "cafPdmUiDragDropInterface.h"
class QVBoxLayout; class QVBoxLayout;
class QTreeView; class QTreeView;
class QItemSelection; class QItemSelection;
@ -48,7 +50,6 @@ namespace caf
{ {
class PdmUiItem; class PdmUiItem;
class PdmUiTreeViewEditor; class PdmUiTreeViewEditor;
class PdmUiDragDropInterface;
class PdmObjectHandle; class PdmObjectHandle;
//================================================================================================== //==================================================================================================
@ -90,6 +91,9 @@ signals:
// Convenience signal for use with PdmUiPropertyView // Convenience signal for use with PdmUiPropertyView
void selectedObjectChanged( caf::PdmObjectHandle* object ); // Signal/Slot system needs caf:: prefix in some cases void selectedObjectChanged( caf::PdmObjectHandle* object ); // Signal/Slot system needs caf:: prefix in some cases
public slots:
void treeVisibilityChanged( bool visible );
private slots: private slots:
void slotOnSelectionChanged(); void slotOnSelectionChanged();

View File

@ -479,6 +479,7 @@ bool PdmUiTreeViewEditor::eventFilter( QObject* obj, QEvent* event )
if ( event->type() == QEvent::FocusIn ) if ( event->type() == QEvent::FocusIn )
{ {
this->updateSelectionManager(); this->updateSelectionManager();
emit selectionChanged();
} }
// standard event processing // standard event processing
@ -504,7 +505,7 @@ void PdmUiTreeViewEditor::updateSelectionManager()
void PdmUiTreeViewEditor::updateItemDelegateForSubTree( const QModelIndex& modelIndex /*= QModelIndex()*/ ) void PdmUiTreeViewEditor::updateItemDelegateForSubTree( const QModelIndex& modelIndex /*= QModelIndex()*/ )
{ {
auto allIndices = m_treeViewModel->allIndicesRecursive(); auto allIndices = m_treeViewModel->allIndicesRecursive();
for ( QModelIndex index : allIndices ) for ( QModelIndex& index : allIndices )
{ {
m_delegate->clearTags( index ); m_delegate->clearTags( index );

View File

@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev")
# Must be unique and increasing within one combination of major/minor/patch version # Must be unique and increasing within one combination of major/minor/patch version
# The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT
# Format of text must be ".xx" # Format of text must be ".xx"
set(RESINSIGHT_DEV_VERSION ".01") set(RESINSIGHT_DEV_VERSION ".02")
# https://github.com/CRAVA/crava/tree/master/libs/nrlib # https://github.com/CRAVA/crava/tree/master/libs/nrlib
set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f")