Helper function to get preferred delete key depending on platform
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/Tools.h>
|
||||
|
||||
#include <Mod/Material/App/Exceptions.h>
|
||||
#include <Mod/Material/App/Materials.h>
|
||||
@@ -76,11 +77,8 @@ Array2D::Array2D(const QString& propertyName,
|
||||
connect(ui->tableView, &QWidget::customContextMenuRequested, this, &Array2D::onContextMenu);
|
||||
|
||||
_deleteAction.setText(tr("Delete row"));
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
_deleteAction.setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
_deleteAction.setShortcut(Gui::QtTools::deleteKeySequence());
|
||||
|
||||
connect(&_deleteAction, &QAction::triggered, this, &Array2D::onDelete);
|
||||
ui->tableView->addAction(&_deleteAction);
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/Tools.h>
|
||||
|
||||
#include <Mod/Material/App/MaterialLibrary.h>
|
||||
|
||||
@@ -90,11 +91,8 @@ MaterialSave::MaterialSave(const std::shared_ptr<Materials::Material>& material,
|
||||
&MaterialSave::onContextMenu);
|
||||
|
||||
_deleteAction.setText(tr("Delete"));
|
||||
{
|
||||
auto& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto shortcut = rcCmdMgr.getCommandByName("Std_Delete")->getShortcut();
|
||||
_deleteAction.setShortcut(QKeySequence(shortcut));
|
||||
}
|
||||
_deleteAction.setShortcut(Gui::QtTools::deleteKeySequence());
|
||||
|
||||
connect(&_deleteAction, &QAction::triggered, this, &MaterialSave::onDelete);
|
||||
ui->treeMaterials->addAction(&_deleteAction);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user