Helper function to get preferred delete key depending on platform
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Selection/Selection.h>
|
||||
#include <Gui/Tools.h>
|
||||
#include <Gui/ViewProvider.h>
|
||||
#include <Mod/PartDesign/App/Body.h>
|
||||
#include <Mod/PartDesign/App/FeatureBoolean.h>
|
||||
@@ -84,15 +85,11 @@ TaskBooleanParameters::TaskBooleanParameters(ViewProviderBoolean* BooleanView, Q
|
||||
|
||||
// Create context menu
|
||||
QAction* action = new QAction(tr("Remove"), this);
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
action->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
action->setShortcut(Gui::QtTools::deleteKeySequence());
|
||||
|
||||
// display shortcut behind the context menu entry
|
||||
action->setShortcutVisibleInContextMenu(true);
|
||||
|
||||
|
||||
ui->listWidgetBodies->addAction(action);
|
||||
connect(action, &QAction::triggered, this, &TaskBooleanParameters::onBodyDeleted);
|
||||
ui->listWidgetBodies->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
|
||||
@@ -305,11 +305,8 @@ void TaskDressUpParameters::createDeleteAction(QListWidget* parentList)
|
||||
// creates a context menu, a shortcut for it and connects it to a slot function
|
||||
|
||||
deleteAction = new QAction(tr("Remove"), this);
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
deleteAction->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
deleteAction->setShortcut(Gui::QtTools::deleteKeySequence());
|
||||
|
||||
// display shortcut behind the context menu entry
|
||||
deleteAction->setShortcutVisibleInContextMenu(true);
|
||||
parentList->addAction(deleteAction);
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/UnitsApi.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Tools.h>
|
||||
#include <Mod/PartDesign/App/FeatureExtrude.h>
|
||||
#include <Mod/Part/Gui/ReferenceHighlighter.h>
|
||||
|
||||
@@ -174,11 +175,8 @@ void TaskExtrudeParameters::setupDialog()
|
||||
translateModeList(index);
|
||||
|
||||
unselectShapeFaceAction = new QAction(tr("Remove"), this);
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
unselectShapeFaceAction->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
unselectShapeFaceAction->setShortcut(Gui::QtTools::deleteKeySequence());
|
||||
|
||||
// display shortcut behind the context menu entry
|
||||
unselectShapeFaceAction->setShortcutVisibleInContextMenu(true);
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <Gui/CommandT.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/Selection/Selection.h>
|
||||
#include <Gui/Tools.h>
|
||||
#include <Mod/PartDesign/App/FeatureLoft.h>
|
||||
|
||||
#include "ui_TaskLoftParameters.h"
|
||||
@@ -72,11 +73,8 @@ TaskLoftParameters::TaskLoftParameters(ViewProviderLoft* LoftView, bool /*newObj
|
||||
|
||||
// Create context menu
|
||||
QAction* remove = new QAction(tr("Remove"), this);
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
remove->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
remove->setShortcut(Gui::QtTools::deleteKeySequence());
|
||||
|
||||
// display shortcut behind the context menu entry
|
||||
remove->setShortcutVisibleInContextMenu(true);
|
||||
ui->listWidgetReferences->addAction(remove);
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/Selection/Selection.h>
|
||||
#include <Gui/Tools.h>
|
||||
#include <Gui/ViewProvider.h>
|
||||
#include <Gui/Widgets.h>
|
||||
#include <Mod/PartDesign/App/Body.h>
|
||||
@@ -86,11 +87,7 @@ TaskPipeParameters::TaskPipeParameters(ViewProviderPipe* PipeView, bool /*newObj
|
||||
|
||||
// Create context menu
|
||||
QAction* remove = new QAction(tr("Remove"), this);
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
remove->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
remove->setShortcut(Gui::QtTools::deleteKeySequence());
|
||||
remove->setShortcutContext(Qt::WidgetShortcut);
|
||||
|
||||
// display shortcut behind the context menu entry
|
||||
@@ -609,11 +606,7 @@ TaskPipeOrientation::TaskPipeOrientation(ViewProviderPipe* PipeView,
|
||||
|
||||
// Create context menu
|
||||
QAction* remove = new QAction(tr("Remove"), this);
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
remove->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
remove->setShortcut(Gui::QtTools::deleteKeySequence());
|
||||
remove->setShortcutContext(Qt::WidgetShortcut);
|
||||
|
||||
// display shortcut behind the context menu entry
|
||||
@@ -901,11 +894,7 @@ TaskPipeScaling::TaskPipeScaling(ViewProviderPipe* PipeView, bool /*newObj*/, QW
|
||||
|
||||
// Create context menu
|
||||
QAction* remove = new QAction(tr("Remove"), this);
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
remove->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
remove->setShortcut(Gui::QtTools::deleteKeySequence());
|
||||
remove->setShortcutContext(Qt::WidgetShortcut);
|
||||
|
||||
// display shortcut behind the context menu entry
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <Gui/CommandT.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/Selection/Selection.h>
|
||||
#include <Gui/Tools.h>
|
||||
#include <Gui/Widgets.h>
|
||||
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
@@ -128,11 +129,7 @@ void TaskShapeBinder::setupContextMenu()
|
||||
{
|
||||
// Create context menu
|
||||
QAction* remove = new QAction(tr("Remove"), this);
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
remove->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
remove->setShortcut(Gui::QtTools::deleteKeySequence());
|
||||
remove->setShortcutContext(Qt::WidgetShortcut);
|
||||
// display shortcut behind the context menu entry
|
||||
remove->setShortcutVisibleInContextMenu(true);
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <Gui/ViewProvider.h>
|
||||
#include <Gui/Selection/Selection.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Tools.h>
|
||||
#include <Mod/PartDesign/App/Body.h>
|
||||
#include <Mod/PartDesign/App/FeatureAddSub.h>
|
||||
#include <Mod/PartDesign/App/FeatureTransformed.h>
|
||||
@@ -102,11 +103,8 @@ void TaskTransformedParameters::setupUI()
|
||||
|
||||
// Create context menu
|
||||
auto action = new QAction(tr("Remove"), this);
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
action->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
action->setShortcut(Gui::QtTools::deleteKeySequence());
|
||||
|
||||
// display shortcut behind the context menu entry
|
||||
action->setShortcutVisibleInContextMenu(true);
|
||||
ui->listWidgetFeatures->addAction(action);
|
||||
|
||||
Reference in New Issue
Block a user