From: Yordan Karadzhov <ykaradzhov@vmware.com>
To: "rostedt@goodmis.org" <rostedt@goodmis.org>
Cc: "linux-trace-devel@vger.kernel.org" <linux-trace-devel@vger.kernel.org>
Subject: [PATCH 3/3] kernel-shark-qt: Make the Quick Contex menu less touchy
Date: Mon, 17 Dec 2018 17:56:02 +0000 [thread overview]
Message-ID: <20181217175516.2944-3-ykaradzhov@vmware.com> (raw)
In-Reply-To: <20181217175516.2944-1-ykaradzhov@vmware.com>
The menu is shifted just a bit so that it is not positioned under
the mouse. This will prevent from an accidental selection of the menu
item under the mouse.
Reported-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
kernel-shark-qt/src/KsTraceGraph.cpp | 7 +++++++
kernel-shark-qt/src/KsTraceViewer.cpp | 7 +++++++
2 files changed, 14 insertions(+)
diff --git a/kernel-shark-qt/src/KsTraceGraph.cpp b/kernel-shark-qt/src/KsTraceGraph.cpp
index 5144f61..462918f 100644
--- a/kernel-shark-qt/src/KsTraceGraph.cpp
+++ b/kernel-shark-qt/src/KsTraceGraph.cpp
@@ -791,6 +791,13 @@ void KsTraceGraph::_onCustomContextMenu(const QPoint &point)
QPoint global = _glWindow.mapToGlobal(point);
global.ry() -= menu->sizeHint().height() / 2;
+ /*
+ * Shift the menu so that it is not positioned under the mouse.
+ * This will prevent from an accidental selection of the menu
+ * item under the mouse.
+ */
+ global.rx() += FONT_WIDTH;
+
menu->exec(global);
}
}
diff --git a/kernel-shark-qt/src/KsTraceViewer.cpp b/kernel-shark-qt/src/KsTraceViewer.cpp
index 09f6a1e..d64c2af 100644
--- a/kernel-shark-qt/src/KsTraceViewer.cpp
+++ b/kernel-shark-qt/src/KsTraceViewer.cpp
@@ -272,6 +272,13 @@ void KsTraceViewer::_onCustomContextMenu(const QPoint &point)
QPoint global = _view.mapToGlobal(point);
global.ry() -= menu.sizeHint().height() / 2;
+ /*
+ * Shift the menu so that it is not positioned under the mouse.
+ * This will prevent from an accidental selection of the menu
+ * item under the mouse.
+ */
+ global.rx() += FONT_WIDTH;
+
connect(&menu, &KsQuickContextMenu::addTaskPlot,
this, &KsTraceViewer::addTaskPlot);
--
2.17.1
prev parent reply other threads:[~2018-12-17 17:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-17 17:55 [PATCH 1/3] kernel-shark-qt: Improve the KsQuickContextMenu Yordan Karadzhov
2018-12-17 17:56 ` [PATCH 2/3] kernel-shark-qt: Better positioning of the Quick Context menu Yordan Karadzhov
2018-12-17 17:56 ` Yordan Karadzhov [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=20181217175516.2944-3-ykaradzhov@vmware.com \
--to=ykaradzhov@vmware.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).