mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4926 Summary Plot : Add push button to edit plot
This commit is contained in:
parent
cea853b94f
commit
6110748192
@ -68,17 +68,7 @@ RicSummaryCurveCreatorDialog* RicEditSummaryPlotFeature::curveCreatorDialog()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEditSummaryPlotFeature::isCommandEnabled()
|
||||
{
|
||||
if ( selectedSummaryPlot() ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEditSummaryPlotFeature::onActionTriggered( bool isChecked )
|
||||
void RicEditSummaryPlotFeature::editSummaryPlot( RimSummaryPlot* plot )
|
||||
{
|
||||
auto dialog = RicEditSummaryPlotFeature::curveCreatorDialog();
|
||||
|
||||
@ -91,13 +81,30 @@ void RicEditSummaryPlotFeature::onActionTriggered( bool isChecked )
|
||||
dialog->raise();
|
||||
}
|
||||
|
||||
// Set target plot
|
||||
if ( selectedSummaryPlot() )
|
||||
if ( plot )
|
||||
{
|
||||
dialog->updateFromSummaryPlot( selectedSummaryPlot() );
|
||||
dialog->updateFromSummaryPlot( plot );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEditSummaryPlotFeature::isCommandEnabled()
|
||||
{
|
||||
if ( selectedSummaryPlot() ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEditSummaryPlotFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
editSummaryPlot( selectedSummaryPlot() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -110,7 +117,7 @@ void RicEditSummaryPlotFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlot* RicEditSummaryPlotFeature::selectedSummaryPlot() const
|
||||
RimSummaryPlot* RicEditSummaryPlotFeature::selectedSummaryPlot()
|
||||
{
|
||||
RimSummaryPlot* sumPlot = nullptr;
|
||||
|
||||
|
@ -35,13 +35,13 @@ public:
|
||||
void closeDialogAndResetTargetPlot();
|
||||
|
||||
static RicSummaryCurveCreatorDialog* curveCreatorDialog();
|
||||
static void editSummaryPlot( RimSummaryPlot* plot );
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
private:
|
||||
RimSummaryPlot* selectedSummaryPlot() const;
|
||||
static RimSummaryPlot* selectedSummaryPlot();
|
||||
};
|
||||
|
@ -21,6 +21,8 @@
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaStdStringTools.h"
|
||||
|
||||
#include "SummaryPlotCommands/RicEditSummaryPlotFeature.h"
|
||||
|
||||
#include "RifReaderEclipseSummary.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
@ -33,6 +35,7 @@
|
||||
#include "RiuQwtPlotCurve.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "cafPdmUiTreeViewEditor.h"
|
||||
|
||||
#include "qwt_plot.h"
|
||||
@ -55,6 +58,10 @@ RimSummaryCurveCollection::RimSummaryCurveCollection()
|
||||
CAF_PDM_InitField( &m_showCurves, "IsActive", true, "Show Curves", "", "", "" );
|
||||
m_showCurves.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &m_editPlot, "EditPlot", false, "", "", "", "" );
|
||||
m_editPlot.xmlCapability()->disableIO();
|
||||
m_editPlot.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_ySourceStepping, "YSourceStepping", "", "", "", "" );
|
||||
m_ySourceStepping = new RimSummaryPlotSourceStepping;
|
||||
m_ySourceStepping->setSourceSteppingType( RimSummaryPlotSourceStepping::Y_AXIS );
|
||||
@ -407,6 +414,33 @@ void RimSummaryCurveCollection::fieldChangedByUi( const caf::PdmFieldHandle* cha
|
||||
{
|
||||
loadDataAndUpdate( true );
|
||||
}
|
||||
else if ( changedField == &m_editPlot )
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
this->firstAncestorOrThisOfType( plot );
|
||||
if ( plot )
|
||||
{
|
||||
RicEditSummaryPlotFeature::editSummaryPlot( plot );
|
||||
}
|
||||
m_editPlot = false;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurveCollection::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( &m_editPlot == field )
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
|
||||
if ( attrib )
|
||||
{
|
||||
attrib->m_buttonText = "Edit Plot";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -85,9 +85,14 @@ private:
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue ) override;
|
||||
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showCurves;
|
||||
caf::PdmChildArrayField<RimSummaryCurve*> m_curves;
|
||||
caf::PdmField<bool> m_editPlot;
|
||||
|
||||
caf::PdmChildField<RimSummaryPlotSourceStepping*> m_ySourceStepping;
|
||||
caf::PdmChildField<RimSummaryPlotSourceStepping*> m_xSourceStepping;
|
||||
|
Loading…
Reference in New Issue
Block a user