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 e850cc9824
commit 2a7498c930
13 changed files with 40 additions and 71 deletions

View File

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