Improve CmdFeature base class

Add default implementation of isEnabled() and add const
This commit is contained in:
Magne Sjaastad
2023-06-26 14:28:46 +02:00
committed by GitHub
parent 59ca0b943c
commit 1da509166a
786 changed files with 638 additions and 1857 deletions

View File

@@ -37,7 +37,7 @@ CAF_CMD_SOURCE_INIT( RicNewAnalysisPlotFeature, "RicNewAnalysisPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewAnalysisPlotFeature::isCommandEnabled()
bool RicNewAnalysisPlotFeature::isCommandEnabled() const
{
if ( caf::firstAncestorOfTypeFromSelectedObject<RimAnalysisPlotCollection>() ) return true;
if ( caf::firstAncestorOfTypeFromSelectedObject<RimSummaryPlot>() ) return true;

View File

@@ -28,7 +28,7 @@ class RicNewAnalysisPlotFeature : public caf::CmdFeature
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() override;
bool isCommandEnabled() const override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -34,7 +34,7 @@ CAF_CMD_SOURCE_INIT( RicNewPlotDataFilterFeature, "RicNewPlotDataFilterFeature"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewPlotDataFilterFeature::isCommandEnabled()
bool RicNewPlotDataFilterFeature::isCommandEnabled() const
{
RimAnalysisPlot* analysisPlot = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimAnalysisPlot>();

View File

@@ -28,7 +28,7 @@ class RicNewPlotDataFilterFeature : public caf::CmdFeature
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() override;
bool isCommandEnabled() const override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};