mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Simplify access to RimMainPlotCollection
* Add current() to RimMainPlotCollection to avoid include of RimProject * Remove "segment" prefix * Reload data when RftCase changes
This commit is contained in:
@@ -18,6 +18,13 @@
|
||||
|
||||
#include "RimRftCase.h"
|
||||
|
||||
#include "RicReloadSummaryCaseFeature.h"
|
||||
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimSummaryCase.h"
|
||||
|
||||
#include "cafPdmUiFilePathEditor.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
@@ -69,3 +76,33 @@ QString RimRftCase::dataDeckFilePath() const
|
||||
{
|
||||
return m_dataDeckFilePath().path();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimRftCase::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
RimSummaryCase* parentCase = nullptr;
|
||||
firstAncestorOfType( parentCase );
|
||||
|
||||
if ( parentCase ) RicReloadSummaryCaseFeature::reloadSummaryCase( parentCase );
|
||||
|
||||
RimMainPlotCollection::current()->loadDataAndUpdateAllPlots();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimRftCase::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_dataDeckFilePath )
|
||||
{
|
||||
auto* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>( attribute );
|
||||
if ( myAttr )
|
||||
{
|
||||
myAttr->m_defaultPath = rftFilePath();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,13 @@ public:
|
||||
QString rftFilePath() const;
|
||||
QString dataDeckFilePath() const;
|
||||
|
||||
private:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<caf::FilePath> m_rftFilePath;
|
||||
caf::PdmField<caf::FilePath> m_dataDeckFilePath;
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include "RimMultiPlotCollection.h"
|
||||
#include "RimMultipleSummaryPlotNameHelper.h"
|
||||
#include "RimPlotAxisProperties.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryAddress.h"
|
||||
#include "RimSummaryAddressCollection.h"
|
||||
#include "RimSummaryAddressModifier.h"
|
||||
@@ -533,8 +532,7 @@ void RimSummaryMultiPlot::updatePlotWindowTitle()
|
||||
|
||||
if ( title.isEmpty() )
|
||||
{
|
||||
auto proj = RimProject::current();
|
||||
auto collections = proj->mainPlotCollection()->summaryMultiPlotCollection();
|
||||
auto collections = RimMainPlotCollection::current()->summaryMultiPlotCollection();
|
||||
|
||||
size_t index = 0;
|
||||
for ( auto p : collections->multiPlots() )
|
||||
|
||||
Reference in New Issue
Block a user