diff mbox series

[4/5] kernel-shark-qt: Do marker-deselect by right mouse click of the button

Message ID 20190212170402.10104-5-ykaradzhov@vmware.com (mailing list archive)
State Accepted
Commit 212ea2ae49058af11686f6ffd7738737a137a664
Headers show
Series The right click of the button deselects the marker | expand

Commit Message

Yordan Karadzhov Feb. 12, 2019, 5:04 p.m. UTC
Methods for deselecting Marker A and B are added to KsMainWindow. Those
methods are connected to the "deselect" signals of the two marker buttons.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202327
Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
 kernel-shark/src/KsMainWindow.cpp | 30 ++++++++++++++++++++++++++++++
 kernel-shark/src/KsMainWindow.hpp |  4 ++++
 2 files changed, 34 insertions(+)
diff mbox series

Patch

diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp
index 06770d9..443b7b0 100644
--- a/kernel-shark/src/KsMainWindow.cpp
+++ b/kernel-shark/src/KsMainWindow.cpp
@@ -119,6 +119,12 @@  KsMainWindow::KsMainWindow(QWidget *parent)
 	connect(&_deselectShortcut,	&QShortcut::activated,
 		this,			&KsMainWindow::_deselect);
 
+	connect(&_mState,	&KsDualMarkerSM::deselectA,
+		this,		&KsMainWindow::_deselectA);
+
+	connect(&_mState,	&KsDualMarkerSM::deselectB,
+		this,		&KsMainWindow::_deselectB);
+
 	_resizeEmpty();
 }
 
@@ -1137,3 +1143,27 @@  void KsMainWindow::_deselect()
 	_mState.updateLabels();
 	_graph.glPtr()->model()->update();
 }
+
+void KsMainWindow::_deselectA()
+{
+	if (_mState.getState() == DualMarkerState::A)
+		_view.clearSelection();
+	else
+		_view.passiveMarkerSelectRow(KS_NO_ROW_SELECTED);
+
+	_mState.markerA().remove();
+	_mState.updateLabels();
+	_graph.glPtr()->model()->update();
+}
+
+void KsMainWindow::_deselectB()
+{
+	if (_mState.getState() == DualMarkerState::B)
+		_view.clearSelection();
+	else
+		_view.passiveMarkerSelectRow(KS_NO_ROW_SELECTED);
+
+	_mState.markerB().remove();
+	_mState.updateLabels();
+	_graph.glPtr()->model()->update();
+}
diff --git a/kernel-shark/src/KsMainWindow.hpp b/kernel-shark/src/KsMainWindow.hpp
index 44f7dd7..abfe196 100644
--- a/kernel-shark/src/KsMainWindow.hpp
+++ b/kernel-shark/src/KsMainWindow.hpp
@@ -218,6 +218,10 @@  private:
 
 	void _deselect();
 
+	void _deselectA();
+
+	void _deselectB();
+
 	void _updateFilterMenu();
 
 	void _filterSyncCBoxUpdate(kshark_context *kshark_ctx);