mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Edit Summary Plot: Improve isCommandEnabled
This commit is contained in:
parent
eec974c53d
commit
0fd2df9f57
@ -68,7 +68,9 @@ void RicEditSummaryPlotFeature::closeDialogAndResetTargetPlot()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RicEditSummaryPlotFeature::isCommandEnabled()
|
bool RicEditSummaryPlotFeature::isCommandEnabled()
|
||||||
{
|
{
|
||||||
return true;
|
if (selectedSummaryPlot()) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -92,11 +94,9 @@ void RicEditSummaryPlotFeature::onActionTriggered(bool isChecked)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set target plot
|
// Set target plot
|
||||||
std::vector<RimSummaryPlot*> plots;
|
if (selectedSummaryPlot())
|
||||||
caf::SelectionManager::instance()->objectsByType(&plots);
|
|
||||||
if (plots.size() == 1)
|
|
||||||
{
|
{
|
||||||
curveCreator->updateFromSummaryPlot(plots.front());
|
curveCreator->updateFromSummaryPlot(selectedSummaryPlot());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,3 +108,19 @@ void RicEditSummaryPlotFeature::setupActionLook(QAction* actionToSetup)
|
|||||||
actionToSetup->setText("Edit Summary Plot");
|
actionToSetup->setText("Edit Summary Plot");
|
||||||
actionToSetup->setIcon(QIcon(":/SummaryPlot16x16.png"));
|
actionToSetup->setIcon(QIcon(":/SummaryPlot16x16.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryPlot* RicEditSummaryPlotFeature::selectedSummaryPlot() const
|
||||||
|
{
|
||||||
|
RimSummaryPlot* sumPlot = nullptr;
|
||||||
|
|
||||||
|
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>(caf::SelectionManager::instance()->selectedItem());
|
||||||
|
if (selObj)
|
||||||
|
{
|
||||||
|
selObj->firstAncestorOrThisOfType(sumPlot);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sumPlot;
|
||||||
|
}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
class RicSummaryCurveCreatorFactoryImpl;
|
class RicSummaryCurveCreatorFactoryImpl;
|
||||||
|
class RimSummaryPlot;
|
||||||
|
|
||||||
namespace caf {
|
namespace caf {
|
||||||
class PdmUiPropertyViewDialog;
|
class PdmUiPropertyViewDialog;
|
||||||
@ -44,6 +45,9 @@ protected:
|
|||||||
virtual void onActionTriggered( bool isChecked );
|
virtual void onActionTriggered( bool isChecked );
|
||||||
virtual void setupActionLook(QAction* actionToSetup);
|
virtual void setupActionLook(QAction* actionToSetup);
|
||||||
|
|
||||||
|
private:
|
||||||
|
RimSummaryPlot* selectedSummaryPlot() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RicSummaryCurveCreatorFactoryImpl* m_curveCreatorFactory;
|
RicSummaryCurveCreatorFactoryImpl* m_curveCreatorFactory;
|
||||||
};
|
};
|
||||||
|
@ -103,9 +103,13 @@ void RicNewSummaryCurveFeature::setupActionLook(QAction* actionToSetup)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimSummaryPlot* RicNewSummaryCurveFeature::selectedSummaryPlot() const
|
RimSummaryPlot* RicNewSummaryCurveFeature::selectedSummaryPlot() const
|
||||||
{
|
{
|
||||||
|
RimSummaryPlot* sumPlot = nullptr;
|
||||||
|
|
||||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>(caf::SelectionManager::instance()->selectedItem());
|
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>(caf::SelectionManager::instance()->selectedItem());
|
||||||
RimSummaryPlot * sumPlot;
|
if (selObj)
|
||||||
selObj->firstAncestorOrThisOfType(sumPlot);
|
{
|
||||||
|
selObj->firstAncestorOrThisOfType(sumPlot);
|
||||||
|
}
|
||||||
|
|
||||||
return sumPlot;
|
return sumPlot;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user