|
25 | 25 | #include "ui_processeswidget.h" |
26 | 26 | #include "ui/uihelper.h" |
27 | 27 |
|
| 28 | +#include <QAction> |
28 | 29 | #include <QClipboard> |
29 | 30 | #include <QGuiApplication> |
30 | 31 | #include <QHeaderView> |
@@ -338,6 +339,15 @@ void ProcessesWidget::setupTable() |
338 | 339 | this->saveTreeHeaderState(); |
339 | 340 | } |
340 | 341 | connect(this->m_treeView, &QTreeView::customContextMenuRequested, this, &ProcessesWidget::onTreeContextMenu); |
| 342 | + |
| 343 | + // Del keyboard shortcut to terminate process |
| 344 | + QAction *terminate_action = new QAction(tr("Terminate (SIGTERM)"), this); |
| 345 | + terminate_action->setShortcut(QKeySequence::Delete); |
| 346 | + terminate_action->setShortcutContext(Qt::WidgetShortcut); |
| 347 | + connect(terminate_action, &QAction::triggered, this, &ProcessesWidget::terminateSelectedProcesses); |
| 348 | + tv->addAction(terminate_action); |
| 349 | + this->m_treeView->addAction(terminate_action); |
| 350 | + |
341 | 351 | this->updateIOMetricsEnabledState(false); |
342 | 352 |
|
343 | 353 | this->setTreeViewMode(CFG->ProcessTreeView); |
@@ -712,6 +722,8 @@ void ProcessesWidget::onTableContextMenu(const QPoint &pos) |
712 | 722 | menu.addSeparator(); |
713 | 723 | QAction *termAction = menu.addAction(tr("Terminate (SIGTERM)")); |
714 | 724 | termAction->setEnabled(hasSelection); |
| 725 | + termAction->setShortcut(QKeySequence::Delete); |
| 726 | + termAction->setShortcutVisibleInContextMenu(true); |
715 | 727 | connect(termAction, &QAction::triggered, this, &ProcessesWidget::terminateSelectedProcesses); |
716 | 728 |
|
717 | 729 | QAction *killAction = menu.addAction(tr("Kill (SIGKILL)")); |
@@ -774,6 +786,8 @@ void ProcessesWidget::onTreeContextMenu(const QPoint &pos) |
774 | 786 | menu.addSeparator(); |
775 | 787 | QAction *termAction = menu.addAction(tr("Terminate (SIGTERM)")); |
776 | 788 | termAction->setEnabled(hasSelection); |
| 789 | + termAction->setShortcut(QKeySequence::Delete); |
| 790 | + termAction->setShortcutVisibleInContextMenu(true); |
777 | 791 | connect(termAction, &QAction::triggered, this, &ProcessesWidget::terminateSelectedProcesses); |
778 | 792 |
|
779 | 793 | QAction *killAction = menu.addAction(tr("Kill (SIGKILL)")); |
|
0 commit comments