diff mbox series

[10/17] kernel-shark-qt: Add keyboard shortcuts for deselecting the marker

Message ID 20181128151530.21965-11-ykaradzhov@vmware.com (mailing list archive)
State Accepted
Commit 04bdc3d9083e20b858c9261195c1eb335e9e0f03
Headers show
Series More modifications and bug fixes toward KS 1.0 | expand

Commit Message

Yordan Karadzhov Nov. 28, 2018, 3:16 p.m. UTC
The active marker can now be deselected by pressing "Ctrl + D".

Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
 kernel-shark-qt/src/KsMainWindow.cpp       | 7 ++++++-
 kernel-shark-qt/src/KsMainWindow.hpp       | 2 ++
 kernel-shark-qt/src/KsQuickContextMenu.cpp | 2 ++
 3 files changed, 10 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/kernel-shark-qt/src/KsMainWindow.cpp b/kernel-shark-qt/src/KsMainWindow.cpp
index 5c9a0fa..f4804bd 100644
--- a/kernel-shark-qt/src/KsMainWindow.cpp
+++ b/kernel-shark-qt/src/KsMainWindow.cpp
@@ -65,7 +65,8 @@  KsMainWindow::KsMainWindow(QWidget *parent)
   _colorPhaseSlider(Qt::Horizontal, this),
   _fullScreenModeAction("Full Screen Mode", this),
   _aboutAction("About", this),
-  _contentsAction("Contents", this)
+  _contentsAction("Contents", this),
+  _deselectShortcut(this)
 {
 	setWindowTitle("Kernel Shark");
 	_createActions();
@@ -114,6 +115,10 @@  KsMainWindow::KsMainWindow(QWidget *parent)
 	connect(&_plugins,	&KsPluginManager::dataReload,
 		&_data,		&KsDataStore::reload);
 
+	_deselectShortcut.setKey(Qt::CTRL + Qt::Key_D);
+	connect(&_deselectShortcut,	&QShortcut::activated,
+		this,			&KsMainWindow::_deselect);
+
 	_resizeEmpty();
 }
 
diff --git a/kernel-shark-qt/src/KsMainWindow.hpp b/kernel-shark-qt/src/KsMainWindow.hpp
index b9b681f..5938a25 100644
--- a/kernel-shark-qt/src/KsMainWindow.hpp
+++ b/kernel-shark-qt/src/KsMainWindow.hpp
@@ -147,6 +147,8 @@  private:
 
 	QAction		_contentsAction;
 
+	QShortcut        _deselectShortcut;
+
 	void _open();
 
 	void _restorSession();
diff --git a/kernel-shark-qt/src/KsQuickContextMenu.cpp b/kernel-shark-qt/src/KsQuickContextMenu.cpp
index 0a8e527..16b8d19 100644
--- a/kernel-shark-qt/src/KsQuickContextMenu.cpp
+++ b/kernel-shark-qt/src/KsQuickContextMenu.cpp
@@ -26,6 +26,8 @@  KsQuickMarkerMenu::KsQuickMarkerMenu(KsDualMarkerSM *dm, QWidget *parent)
 	if (dm->activeMarker()._isSet) {
 		addSection("Marker menu");
 		_deselectAction.setText("Deselect");
+		_deselectAction.setShortcut(tr("Ctrl+D"));
+		_deselectAction.setStatusTip(tr("Deselect marker"));
 
 		connect(&_deselectAction,	&QAction::triggered,
 			this,			&KsQuickMarkerMenu::deselect);