linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org,
	"Yordan Karadzhov (VMware)" <y.karadz@gmail.com>,
	FeRD <ferdnyc@gmail.com>
Subject: [PATCH 1/1] kernel-shark: Use mouse wheel to scroll the graphs
Date: Mon, 25 Jan 2021 16:05:39 +0200	[thread overview]
Message-ID: <20210125140539.1029915-2-y.karadz@gmail.com> (raw)
In-Reply-To: <20210125140539.1029915-1-y.karadz@gmail.com>

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.

Suggested-by: FeRD (Frank Dana) <ferdnyc@gmail.com>
Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 kernel-shark/src/KsGLWidget.cpp   | 3 ++-
 kernel-shark/src/KsTraceGraph.hpp | 5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel-shark/src/KsGLWidget.cpp b/kernel-shark/src/KsGLWidget.cpp
index 78ded33..404f0d0 100644
--- a/kernel-shark/src/KsGLWidget.cpp
+++ b/kernel-shark/src/KsGLWidget.cpp
@@ -266,7 +266,8 @@ void KsGLWidget::wheelEvent(QWheelEvent * event)
 {
 	int zoomFocus;
 
-	if (isEmpty())
+	if (QApplication::keyboardModifiers() != Qt::ControlModifier ||
+	    isEmpty())
 		return;
 
 	if (_mState->activeMarker()._isSet &&
diff --git a/kernel-shark/src/KsTraceGraph.hpp b/kernel-shark/src/KsTraceGraph.hpp
index 0eeef14..15ade42 100644
--- a/kernel-shark/src/KsTraceGraph.hpp
+++ b/kernel-shark/src/KsTraceGraph.hpp
@@ -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);
+	}
 };
 
 /**
-- 
2.25.1


      reply	other threads:[~2021-01-25 14:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25 14:05 [PATCH 0/1] kernel-shark v1 changed Yordan Karadzhov (VMware)
2021-01-25 14:05 ` Yordan Karadzhov (VMware) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210125140539.1029915-2-y.karadz@gmail.com \
    --to=y.karadz@gmail.com \
    --cc=ferdnyc@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).