linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] kernel-shark-qt: Correct the coordinates of the Quick Context Menu
@ 2018-11-30 15:38 Yordan Karadzhov
  2018-11-30 15:38 ` [PATCH 2/2] kernel-shark-qt: Add better handling of the search iterator Yordan Karadzhov
  2018-11-30 15:58 ` [PATCH 1/2] kernel-shark-qt: Correct the coordinates of the Quick Context Menu Steven Rostedt
  0 siblings, 2 replies; 3+ messages in thread
From: Yordan Karadzhov @ 2018-11-30 15:38 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

The "Y" coordinate of the Quick Context Menu has to be corrected in
the case when the menu gets opened from the Graph widget. This is
needed because the Graph widget is nested inside a scroll area and
we have to take into account the offset of the vertical scrollbar.

Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
 kernel-shark-qt/src/KsTraceGraph.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/kernel-shark-qt/src/KsTraceGraph.cpp b/kernel-shark-qt/src/KsTraceGraph.cpp
index 0b5a8b1..858930c 100644
--- a/kernel-shark-qt/src/KsTraceGraph.cpp
+++ b/kernel-shark-qt/src/KsTraceGraph.cpp
@@ -782,6 +782,12 @@ void KsTraceGraph::_onCustomContextMenu(const QPoint &point)
 		connect(menu,	&KsQuickMarkerMenu::deselect,
 			this,	&KsTraceGraph::deselect);
 
-		menu->exec(mapToGlobal(point));
+		QPoint global = mapToGlobal(point);
+		/*
+		 * The global coordinates have to be corrected for the offset
+		 * of the vertical scrollbar.
+		 */
+		global.ry() -= _scrollArea.verticalScrollBar()->value();
+		menu->exec(global);
 	}
 }
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] kernel-shark-qt: Add better handling of the search iterator.
  2018-11-30 15:38 [PATCH 1/2] kernel-shark-qt: Correct the coordinates of the Quick Context Menu Yordan Karadzhov
@ 2018-11-30 15:38 ` Yordan Karadzhov
  2018-11-30 15:58 ` [PATCH 1/2] kernel-shark-qt: Correct the coordinates of the Quick Context Menu Steven Rostedt
  1 sibling, 0 replies; 3+ messages in thread
From: Yordan Karadzhov @ 2018-11-30 15:38 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

This patch provides better handling of the search iterator in the case
when no matches are found. Without these fixes, the search iterator
shows an arbitrary value when we load a session that has the active
marker being set.

Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>
---
 kernel-shark-qt/src/KsTraceViewer.cpp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/kernel-shark-qt/src/KsTraceViewer.cpp b/kernel-shark-qt/src/KsTraceViewer.cpp
index d52d7e3..a308ea0 100644
--- a/kernel-shark-qt/src/KsTraceViewer.cpp
+++ b/kernel-shark-qt/src/KsTraceViewer.cpp
@@ -420,8 +420,13 @@ void KsTraceViewer::_prev()
 
 void KsTraceViewer::_updateSearchCount()
 {
-	int index(_it - _matchList.begin());
-	int total(_matchList.count());
+	int index, total;
+
+	if (_matchList.isEmpty())
+		return;
+
+	index = _it - _matchList.begin();
+	total =_matchList.count();
 
 	_searchCountLabel.setText(QString(" %1 / %2").arg(index).arg(total));
 }
@@ -655,6 +660,7 @@ size_t KsTraceViewer::_searchItems(int column,
 
 void KsTraceViewer::_setSearchIterator(int row)
 {
+	_it = _matchList.begin();
 	if (_matchList.isEmpty())
 		return;
 
@@ -662,7 +668,6 @@ void KsTraceViewer::_setSearchIterator(int row)
 	 * Move the iterator to the first element of the match list
 	 * after the selected one.
 	 */
-	_it = _matchList.begin();
 	while (*_it < row) {
 		++_it;  // Move the iterator.
 		if (_it == _matchList.end()) {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] kernel-shark-qt: Correct the coordinates of the Quick Context Menu
  2018-11-30 15:38 [PATCH 1/2] kernel-shark-qt: Correct the coordinates of the Quick Context Menu Yordan Karadzhov
  2018-11-30 15:38 ` [PATCH 2/2] kernel-shark-qt: Add better handling of the search iterator Yordan Karadzhov
@ 2018-11-30 15:58 ` Steven Rostedt
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2018-11-30 15:58 UTC (permalink / raw)
  To: Yordan Karadzhov; +Cc: linux-trace-devel

On Fri, 30 Nov 2018 15:38:11 +0000
Yordan Karadzhov <ykaradzhov@vmware.com> wrote:

> The "Y" coordinate of the Quick Context Menu has to be corrected in
> the case when the menu gets opened from the Graph widget. This is
> needed because the Graph widget is nested inside a scroll area and
> we have to take into account the offset of the vertical scrollbar.
> 
> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com>

Thanks!

I applied both patches.

-- Steve

> ---
>  kernel-shark-qt/src/KsTraceGraph.cpp | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel-shark-qt/src/KsTraceGraph.cpp b/kernel-shark-qt/src/KsTraceGraph.cpp
> index 0b5a8b1..858930c 100644
> --- a/kernel-shark-qt/src/KsTraceGraph.cpp
> +++ b/kernel-shark-qt/src/KsTraceGraph.cpp
> @@ -782,6 +782,12 @@ void KsTraceGraph::_onCustomContextMenu(const QPoint &point)
>  		connect(menu,	&KsQuickMarkerMenu::deselect,
>  			this,	&KsTraceGraph::deselect);
>  
> -		menu->exec(mapToGlobal(point));
> +		QPoint global = mapToGlobal(point);
> +		/*
> +		 * The global coordinates have to be corrected for the offset
> +		 * of the vertical scrollbar.
> +		 */
> +		global.ry() -= _scrollArea.verticalScrollBar()->value();
> +		menu->exec(global);
>  	}
>  }

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-01  3:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-30 15:38 [PATCH 1/2] kernel-shark-qt: Correct the coordinates of the Quick Context Menu Yordan Karadzhov
2018-11-30 15:38 ` [PATCH 2/2] kernel-shark-qt: Add better handling of the search iterator Yordan Karadzhov
2018-11-30 15:58 ` [PATCH 1/2] kernel-shark-qt: Correct the coordinates of the Quick Context Menu Steven Rostedt

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).