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

@@ -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*>();

View File

@@ -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;

View File

@@ -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*>();

View File

@@ -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;

View File

@@ -39,14 +39,6 @@
CAF_CMD_SOURCE_INIT( RicCreateTextAnnotationIn3dViewFeature, "RicCreateTextAnnotationIn3dViewFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicCreateTextAnnotationIn3dViewFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -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;
};

View File

@@ -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*>();

View File

@@ -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;

View File

@@ -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*>();

View File

@@ -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;
};