mirror of
https://github.com/OPM/ResInsight.git
synced 2026-11-02 20:30:46 -06:00
Improve CmdFeature base class
Add default implementation of isEnabled() and add const
This commit is contained in:
1 parent
59ca0b943c
commit
1da509166a
786 files changed
+638
-1857
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user