From 0310a99f4e52b9b7e9e2ca69c87fc2f85fd7dc3f Mon Sep 17 00:00:00 2001 From: donovaly Date: Fri, 14 Feb 2020 01:28:50 +0100 Subject: [PATCH] [PD] add shortcut to context menus - people should be informed that there is a shortcut available (that was recently added) - make the shortcut also translatable since "Del" means nothing in e.g. German - minor code style fix in TaskDressUpParameters.h --- src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp | 6 +++++- src/Mod/PartDesign/Gui/TaskChamferParameters.cpp | 6 +++++- src/Mod/PartDesign/Gui/TaskDraftParameters.cpp | 6 +++++- src/Mod/PartDesign/Gui/TaskDressUpParameters.h | 2 +- src/Mod/PartDesign/Gui/TaskFilletParameters.cpp | 6 +++++- src/Mod/PartDesign/Gui/TaskLinearPatternParameters.cpp | 6 +++++- src/Mod/PartDesign/Gui/TaskMirroredParameters.cpp | 6 +++++- src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp | 6 +++++- src/Mod/PartDesign/Gui/TaskPolarPatternParameters.cpp | 6 +++++- src/Mod/PartDesign/Gui/TaskScaledParameters.cpp | 6 +++++- src/Mod/PartDesign/Gui/TaskThicknessParameters.cpp | 6 +++++- 11 files changed, 51 insertions(+), 11 deletions(-) diff --git a/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp b/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp index 105f70440c..b407ec3fe0 100644 --- a/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp @@ -82,7 +82,11 @@ TaskBooleanParameters::TaskBooleanParameters(ViewProviderBoolean *BooleanView,QW // Create context menu QAction* action = new QAction(tr("Remove"), this); - action->setShortcut(QString::fromLatin1("Del")); + action->setShortcut(tr("Del")); +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + // display shortcut behind the context menu entry + action->setShortcutVisibleInContextMenu(true); +#endif ui->listWidgetBodies->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onBodyDeleted())); ui->listWidgetBodies->setContextMenuPolicy(Qt::ActionsContextMenu); diff --git a/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp b/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp index e7b25fa001..98cea7d130 100644 --- a/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp @@ -85,7 +85,11 @@ TaskChamferParameters::TaskChamferParameters(ViewProviderDressUp *DressUpView,QW // Create context menu QAction* action = new QAction(tr("Remove"), this); - action->setShortcut(QString::fromLatin1("Del")); + action->setShortcut(tr("Del")); +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + // display shortcut behind the context menu entry + action->setShortcutVisibleInContextMenu(true); +#endif ui->listWidgetReferences->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onRefDeleted())); ui->listWidgetReferences->setContextMenuPolicy(Qt::ActionsContextMenu); diff --git a/src/Mod/PartDesign/Gui/TaskDraftParameters.cpp b/src/Mod/PartDesign/Gui/TaskDraftParameters.cpp index 71f27eb651..eb794754e3 100644 --- a/src/Mod/PartDesign/Gui/TaskDraftParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskDraftParameters.cpp @@ -99,7 +99,11 @@ TaskDraftParameters::TaskDraftParameters(ViewProviderDressUp *DressUpView,QWidge // Create context menu QAction* action = new QAction(tr("Remove"), this); - action->setShortcut(QString::fromLatin1("Del")); + action->setShortcut(tr("Del")); +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + // display shortcut behind the context menu entry + action->setShortcutVisibleInContextMenu(true); +#endif ui->listWidgetReferences->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onRefDeleted())); ui->listWidgetReferences->setContextMenuPolicy(Qt::ActionsContextMenu); diff --git a/src/Mod/PartDesign/Gui/TaskDressUpParameters.h b/src/Mod/PartDesign/Gui/TaskDressUpParameters.h index aaecc506d9..8ad4b67a1f 100644 --- a/src/Mod/PartDesign/Gui/TaskDressUpParameters.h +++ b/src/Mod/PartDesign/Gui/TaskDressUpParameters.h @@ -60,7 +60,7 @@ public: protected Q_SLOTS: void onButtonRefAdd(const bool checked); void onButtonRefRemove(const bool checked); - virtual void onRefDeleted(void)=0; + virtual void onRefDeleted(void) = 0; protected: void exitSelectionMode(); diff --git a/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp b/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp index 100265b80e..0a28fddea9 100644 --- a/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp @@ -85,7 +85,11 @@ TaskFilletParameters::TaskFilletParameters(ViewProviderDressUp *DressUpView,QWid // Create context menu QAction* action = new QAction(tr("Remove"), this); - action->setShortcut(QString::fromLatin1("Del")); + action->setShortcut(tr("Del")); +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + // display shortcut behind the context menu entry + action->setShortcutVisibleInContextMenu(true); +#endif ui->listWidgetReferences->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onRefDeleted())); ui->listWidgetReferences->setContextMenuPolicy(Qt::ActionsContextMenu); diff --git a/src/Mod/PartDesign/Gui/TaskLinearPatternParameters.cpp b/src/Mod/PartDesign/Gui/TaskLinearPatternParameters.cpp index 2771f83a8d..ee4ac04949 100644 --- a/src/Mod/PartDesign/Gui/TaskLinearPatternParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskLinearPatternParameters.cpp @@ -113,7 +113,11 @@ void TaskLinearPatternParameters::setupUI() // Create context menu QAction* action = new QAction(tr("Remove"), this); - action->setShortcut(QString::fromLatin1("Del")); + action->setShortcut(tr("Del")); +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + // display shortcut behind the context menu entry + action->setShortcutVisibleInContextMenu(true); +#endif ui->listWidgetFeatures->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onFeatureDeleted())); ui->listWidgetFeatures->setContextMenuPolicy(Qt::ActionsContextMenu); diff --git a/src/Mod/PartDesign/Gui/TaskMirroredParameters.cpp b/src/Mod/PartDesign/Gui/TaskMirroredParameters.cpp index 3a50522527..9216425f24 100644 --- a/src/Mod/PartDesign/Gui/TaskMirroredParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskMirroredParameters.cpp @@ -110,7 +110,11 @@ void TaskMirroredParameters::setupUI() // Create context menu QAction* action = new QAction(tr("Remove"), this); - action->setShortcut(QString::fromLatin1("Del")); + action->setShortcut(tr("Del")); +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + // display shortcut behind the context menu entry + action->setShortcutVisibleInContextMenu(true); +#endif ui->listWidgetFeatures->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onFeatureDeleted())); ui->listWidgetFeatures->setContextMenuPolicy(Qt::ActionsContextMenu); diff --git a/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp b/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp index 96007d4c96..aee6bfc060 100644 --- a/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp @@ -75,7 +75,11 @@ TaskMultiTransformParameters::TaskMultiTransformParameters(ViewProviderTransform // Create context menu QAction* action = new QAction(tr("Remove"), this); - action->setShortcut(QString::fromLatin1("Del")); + action->setShortcut(tr("Del")); +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + // display shortcut behind the context menu entry + action->setShortcutVisibleInContextMenu(true); +#endif ui->listWidgetFeatures->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onFeatureDeleted())); ui->listWidgetFeatures->setContextMenuPolicy(Qt::ActionsContextMenu); diff --git a/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.cpp b/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.cpp index bf922556f3..aa4a314aac 100644 --- a/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.cpp @@ -111,7 +111,11 @@ void TaskPolarPatternParameters::setupUI() // Create context menu QAction* action = new QAction(tr("Remove"), this); - action->setShortcut(QString::fromLatin1("Del")); + action->setShortcut(tr("Del")); +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + // display shortcut behind the context menu entry + action->setShortcutVisibleInContextMenu(true); +#endif ui->listWidgetFeatures->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onFeatureDeleted())); ui->listWidgetFeatures->setContextMenuPolicy(Qt::ActionsContextMenu); diff --git a/src/Mod/PartDesign/Gui/TaskScaledParameters.cpp b/src/Mod/PartDesign/Gui/TaskScaledParameters.cpp index c91295397b..f4e616f6f3 100644 --- a/src/Mod/PartDesign/Gui/TaskScaledParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskScaledParameters.cpp @@ -97,7 +97,11 @@ void TaskScaledParameters::setupUI() // Create context menu QAction* action = new QAction(tr("Remove"), this); - action->setShortcut(QString::fromLatin1("Del")); + action->setShortcut(tr("Del")); +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + // display shortcut behind the context menu entry + action->setShortcutVisibleInContextMenu(true); +#endif ui->listWidgetFeatures->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onFeatureDeleted())); ui->listWidgetFeatures->setContextMenuPolicy(Qt::ActionsContextMenu); diff --git a/src/Mod/PartDesign/Gui/TaskThicknessParameters.cpp b/src/Mod/PartDesign/Gui/TaskThicknessParameters.cpp index 02bb13e86a..13ea581080 100644 --- a/src/Mod/PartDesign/Gui/TaskThicknessParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskThicknessParameters.cpp @@ -101,7 +101,11 @@ TaskThicknessParameters::TaskThicknessParameters(ViewProviderDressUp *DressUpVie // Create context menu QAction* action = new QAction(tr("Remove"), this); - action->setShortcut(QString::fromLatin1("Del")); + action->setShortcut(tr("Del")); +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + // display shortcut behind the context menu entry + action->setShortcutVisibleInContextMenu(true); +#endif ui->listWidgetReferences->addAction(action); connect(action, SIGNAL(triggered()), this, SLOT(onRefDeleted())); ui->listWidgetReferences->setContextMenuPolicy(Qt::ActionsContextMenu);