Helper function to get preferred delete key depending on platform

This commit is contained in:
wmayer
2025-04-28 09:57:15 +02:00
committed by Benjamin Nauck
parent 64497cea4b
commit 017f2c8842
13 changed files with 40 additions and 71 deletions

View File

@@ -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