mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fix up keyboard shorcut on < Qt 5.10
This commit is contained in:
@@ -155,6 +155,20 @@ bool CmdFeature::canFeatureBeExecuted()
|
||||
return this->isCommandEnabled();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void CmdFeature::applyShortcutWithHintToAction(QAction* action, const QKeySequence& keySequence)
|
||||
{
|
||||
action->setShortcut(keySequence);
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
// Qt made keyboard shortcuts in context menus platform dependent in Qt 5.10
|
||||
// With no global way of removing it.
|
||||
action->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
|
||||
class QAction;
|
||||
class QIcon;
|
||||
class QKeySequence;
|
||||
class QString;
|
||||
|
||||
#define CAF_CMD_HEADER_INIT \
|
||||
@@ -84,6 +85,8 @@ public:
|
||||
|
||||
bool canFeatureBeExecuted();
|
||||
|
||||
static void applyShortcutWithHintToAction(QAction* action, const QKeySequence& keySequence);
|
||||
|
||||
public slots:
|
||||
void actionTriggered(bool isChecked);
|
||||
|
||||
|
||||
@@ -140,8 +140,7 @@ void CmdDeleteItemFeature::onActionTriggered(bool isChecked)
|
||||
void CmdDeleteItemFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Delete object");
|
||||
actionToSetup->setShortcut(QKeySequence::Delete);
|
||||
actionToSetup->setShortcutVisibleInContextMenu(true);
|
||||
applyShortcutWithHintToAction(actionToSetup, QKeySequence::Delete);
|
||||
}
|
||||
|
||||
} // end namespace caf
|
||||
|
||||
Reference in New Issue
Block a user