Skip to contentSkip to conversation

kernel-shark v1 changed.

PATCH New Yordan Karadzhov (VMware) 1 participant 2 messages Jan 25, 2021

lore
Share & tools
lore
#0 lore raw

cover kernel-shark v1 changed.

This is a KernelShark v1 patch. To be applied to the trace-cmd repo.

Yordan Karadzhov (VMware) (1):
kernel-shark: Use mouse wheel to scroll the graphs

 kernel-shark/src/KsGLWidget.cpp   | 3 ++-
 kernel-shark/src/KsTraceGraph.hpp | 5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 kernel-shark: Use mouse wheel to scroll the graphs

The current zoom-in/zoom-out function of the mouse wheel will be performed only when rolling the mouse wheel and simultaneously pressing "Ctrl", while just rolling the wheel will move you up or down in the scroll area of the graphs without zooming.

We want to introduce the change because zoom via Ctrl+ScrollWheel is a binding familiar from the Web Browsers.

---
 kernel-shark/src/KsGLWidget.cpp   | 3 ++-
 kernel-shark/src/KsTraceGraph.hpp | 5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
kernel-shark/src/KsGLWidget.cpp +2 -1
index 78ded33..404f0d0 100644
@@ -266,7 +266,8 @@ void KsGLWidget::wheelEvent(QWheelEvent * event)
 {
 	int zoomFocus;
 
-	if (isEmpty())
+	if (QApplication::keyboardModifiers() != Qt::ControlModifier ||
+	    isEmpty())
 		return;
 
 	if (_mState->activeMarker()._isSet &&
kernel-shark/src/KsTraceGraph.hpp +4 -1
index 0eeef14..15ade42 100644
@@ -28,7 +28,10 @@ public:
 	 * Reimplemented handler for mouse wheel events. All mouse wheel
 	 * events will be ignored.
 	 */
-	void wheelEvent(QWheelEvent *evt) {evt->ignore();}
+	void wheelEvent(QWheelEvent *evt) {
+		if (QApplication::keyboardModifiers() != Qt::ControlModifier)
+			QScrollArea::wheelEvent(evt);
+	}
 };
 
 /**
Signature · 1 line
2.25.1