Reuse Std_Delete shortcut instead of hardcoding Delete (#16682)
* Reuse Std_Delete shortcut in TaskBooleanParameters * Reuse Std_Delete shortcut in TaskDressUpParameters * Reuse Std_Delete shortcut in TaskLoftParameters * Reuse Std_Delete shortcut in TaskPipeParameters * Reuse Std_Delete shortcut in TaskSapeBinder * Reuse Std_Delete shortcut in TaskTransformedParameters * Reuse Std_Delete shortcut in TaskExtrudeParameters * Reuse Std_Delete shortcut in TaskSections * Reuse Std_Delete shortcut in MaterialSave * Reuse Std_Delete shortcut in Array2D * Reuse Std_Delete shortcut in TaskFemConstraint * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -168,7 +168,11 @@ void TaskFemConstraint::createDeleteAction(QListWidget* parentList)
|
||||
// creates a context menu, a shortcut for it and connects it to a slot function
|
||||
|
||||
deleteAction = new QAction(tr("Delete"), this);
|
||||
deleteAction->setShortcut(QKeySequence::Delete);
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
deleteAction->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
// display shortcut behind the context menu entry
|
||||
deleteAction->setShortcutVisibleInContextMenu(true);
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include <QMessageBox>
|
||||
#endif
|
||||
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
|
||||
#include <Mod/Material/App/Exceptions.h>
|
||||
@@ -74,7 +76,11 @@ Array2D::Array2D(const QString& propertyName,
|
||||
connect(ui->tableView, &QWidget::customContextMenuRequested, this, &Array2D::onContextMenu);
|
||||
|
||||
_deleteAction.setText(tr("Delete row"));
|
||||
_deleteAction.setShortcut(QKeySequence::Delete);
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
_deleteAction.setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
connect(&_deleteAction, &QAction::triggered, this, &Array2D::onDelete);
|
||||
ui->tableView->addAction(&_deleteAction);
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include <QTreeView>
|
||||
#endif
|
||||
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
|
||||
#include <Mod/Material/App/MaterialLibrary.h>
|
||||
@@ -87,7 +89,11 @@ MaterialSave::MaterialSave(const std::shared_ptr<Materials::Material>& material,
|
||||
&MaterialSave::onContextMenu);
|
||||
|
||||
_deleteAction.setText(tr("Delete"));
|
||||
_deleteAction.setShortcut(QKeySequence::Delete);
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
_deleteAction.setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
connect(&_deleteAction, &QAction::triggered, this, &MaterialSave::onDelete);
|
||||
ui->treeMaterials->addAction(&_deleteAction);
|
||||
|
||||
|
||||
@@ -84,7 +84,11 @@ TaskBooleanParameters::TaskBooleanParameters(ViewProviderBoolean* BooleanView, Q
|
||||
|
||||
// Create context menu
|
||||
QAction* action = new QAction(tr("Remove"), this);
|
||||
action->setShortcut(QKeySequence::Delete);
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
action->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
// display shortcut behind the context menu entry
|
||||
action->setShortcutVisibleInContextMenu(true);
|
||||
|
||||
@@ -291,7 +291,11 @@ 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);
|
||||
deleteAction->setShortcut(QKeySequence::Delete);
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
deleteAction->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
// display shortcut behind the context menu entry
|
||||
deleteAction->setShortcutVisibleInContextMenu(true);
|
||||
|
||||
@@ -174,7 +174,11 @@ void TaskExtrudeParameters::setupDialog()
|
||||
translateModeList(index);
|
||||
|
||||
unselectShapeFaceAction = new QAction(tr("Remove"), this);
|
||||
unselectShapeFaceAction->setShortcut(QKeySequence::Delete);
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
unselectShapeFaceAction->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
// display shortcut behind the context menu entry
|
||||
unselectShapeFaceAction->setShortcutVisibleInContextMenu(true);
|
||||
|
||||
@@ -72,7 +72,11 @@ TaskLoftParameters::TaskLoftParameters(ViewProviderLoft* LoftView, bool /*newObj
|
||||
|
||||
// Create context menu
|
||||
QAction* remove = new QAction(tr("Remove"), this);
|
||||
remove->setShortcut(QKeySequence::Delete);
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
remove->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
// display shortcut behind the context menu entry
|
||||
remove->setShortcutVisibleInContextMenu(true);
|
||||
|
||||
@@ -86,7 +86,11 @@ TaskPipeParameters::TaskPipeParameters(ViewProviderPipe* PipeView, bool /*newObj
|
||||
|
||||
// Create context menu
|
||||
QAction* remove = new QAction(tr("Remove"), this);
|
||||
remove->setShortcut(QKeySequence::Delete);
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
remove->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
remove->setShortcutContext(Qt::WidgetShortcut);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
// display shortcut behind the context menu entry
|
||||
@@ -605,7 +609,11 @@ TaskPipeOrientation::TaskPipeOrientation(ViewProviderPipe* PipeView,
|
||||
|
||||
// Create context menu
|
||||
QAction* remove = new QAction(tr("Remove"), this);
|
||||
remove->setShortcut(QKeySequence::Delete);
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
remove->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
remove->setShortcutContext(Qt::WidgetShortcut);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
// display shortcut behind the context menu entry
|
||||
@@ -894,7 +902,11 @@ TaskPipeScaling::TaskPipeScaling(ViewProviderPipe* PipeView, bool /*newObj*/, QW
|
||||
|
||||
// Create context menu
|
||||
QAction* remove = new QAction(tr("Remove"), this);
|
||||
remove->setShortcut(QKeySequence::Delete);
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
remove->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
remove->setShortcutContext(Qt::WidgetShortcut);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
// display shortcut behind the context menu entry
|
||||
|
||||
@@ -128,7 +128,11 @@ void TaskShapeBinder::setupContextMenu()
|
||||
{
|
||||
// Create context menu
|
||||
QAction* remove = new QAction(tr("Remove"), this);
|
||||
remove->setShortcut(QKeySequence::Delete);
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
remove->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
remove->setShortcutContext(Qt::WidgetShortcut);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
// display shortcut behind the context menu entry
|
||||
|
||||
@@ -102,7 +102,11 @@ void TaskTransformedParameters::setupUI()
|
||||
|
||||
// Create context menu
|
||||
auto action = new QAction(tr("Remove"), this);
|
||||
action->setShortcut(QKeySequence::Delete);
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
action->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
// display shortcut behind the context menu entry
|
||||
action->setShortcutVisibleInContextMenu(true);
|
||||
ui->listWidgetFeatures->addAction(action);
|
||||
|
||||
@@ -279,7 +279,11 @@ SectionsPanel::SectionsPanel(ViewProviderSections* vp, Surface::Sections* obj)
|
||||
|
||||
// Create context menu
|
||||
QAction* action = new QAction(tr("Remove"), this);
|
||||
action->setShortcut(QKeySequence::Delete);
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
action->setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
ui->listSections->addAction(action);
|
||||
connect(action, &QAction::triggered, this, &SectionsPanel::onDeleteEdge);
|
||||
ui->listSections->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
|
||||
Reference in New Issue
Block a user