Improve CmdFeature base class

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

No files matched your search

+10 -2
View File
@@ -151,7 +151,7 @@ void CmdFeature::refreshCheckedState()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool CmdFeature::canFeatureBeExecuted()
bool CmdFeature::canFeatureBeExecuted() const
{
return this->isCommandEnabled();
}
@@ -186,7 +186,15 @@ void CmdFeature::actionTriggered( bool isChecked )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool CmdFeature::isCommandChecked()
bool CmdFeature::isCommandEnabled() const
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool CmdFeature::isCommandChecked() const
{
return false;
}
+3 -3
View File
@@ -84,7 +84,7 @@ public:
void refreshEnabledState();
void refreshCheckedState();
bool canFeatureBeExecuted();
bool canFeatureBeExecuted() const;
static void applyShortcutWithHintToAction( QAction* action, const QKeySequence& keySequence );
@@ -94,8 +94,8 @@ public slots:
protected:
virtual void onActionTriggered( bool isChecked ) = 0;
virtual void setupActionLook( QAction* actionToSetup ) = 0;
virtual bool isCommandEnabled() = 0;
virtual bool isCommandChecked();
virtual bool isCommandEnabled() const;
virtual bool isCommandChecked() const;
void disableModelChangeContribution();
const QVariant userData() const;