mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Improve CmdFeature base class
Add default implementation of isEnabled() and add const
This commit is contained in:
@@ -41,7 +41,7 @@ CAF_CMD_SOURCE_INIT( RicCreateReachCircleAnnotationFeature, "RicCreateReachCircl
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreateReachCircleAnnotationFeature::isCommandEnabled()
|
||||
bool RicCreateReachCircleAnnotationFeature::isCommandEnabled() const
|
||||
{
|
||||
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
|
||||
auto selGroupColl = caf::selectedObjectsByTypeStrict<RimAnnotationGroupCollection*>();
|
||||
|
||||
@@ -32,7 +32,7 @@ class RicCreateReachCircleAnnotationFeature : 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;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ CAF_CMD_SOURCE_INIT( RicCreateTextAnnotationFeature, "RicCreateTextAnnotationFea
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreateTextAnnotationFeature::isCommandEnabled()
|
||||
bool RicCreateTextAnnotationFeature::isCommandEnabled() const
|
||||
{
|
||||
auto selObjsGlobal = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
|
||||
auto selObjs2InView = caf::selectedObjectsByTypeStrict<RimAnnotationInViewCollection*>();
|
||||
|
||||
@@ -34,7 +34,7 @@ class RicCreateTextAnnotationFeature : 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;
|
||||
|
||||
|
||||
@@ -39,14 +39,6 @@
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicCreateTextAnnotationIn3dViewFeature, "RicCreateTextAnnotationIn3dViewFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreateTextAnnotationIn3dViewFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -28,7 +28,6 @@ class RicCreateTextAnnotationIn3dViewFeature : public caf::CmdFeature
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
|
||||
@@ -41,7 +41,7 @@ CAF_CMD_SOURCE_INIT( RicCreateUserDefinedPolylinesAnnotationFeature, "RicCreateU
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreateUserDefinedPolylinesAnnotationFeature::isCommandEnabled()
|
||||
bool RicCreateUserDefinedPolylinesAnnotationFeature::isCommandEnabled() const
|
||||
{
|
||||
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
|
||||
auto selGroupColl = caf::selectedObjectsByTypeStrict<RimAnnotationGroupCollection*>();
|
||||
|
||||
@@ -32,7 +32,7 @@ class RicCreateUserDefinedPolylinesAnnotationFeature : 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;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ CAF_CMD_SOURCE_INIT( RicImportPolylinesAnnotationFeature, "RicImportPolylinesAnn
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicImportPolylinesAnnotationFeature::isCommandEnabled()
|
||||
bool RicImportPolylinesAnnotationFeature::isCommandEnabled() const
|
||||
{
|
||||
auto selObjs = caf::selectedObjectsByTypeStrict<RimAnnotationCollection*>();
|
||||
auto selGroupColl = caf::selectedObjectsByTypeStrict<RimAnnotationGroupCollection*>();
|
||||
|
||||
@@ -28,7 +28,7 @@ class RicImportPolylinesAnnotationFeature : 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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user