From patchwork Fri Nov 30 15:38:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10760081 Return-Path: Received: from mail-eopbgr690083.outbound.protection.outlook.com ([40.107.69.83]:12320 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726572AbeLACr5 (ORCPT ); Fri, 30 Nov 2018 21:47:57 -0500 From: Yordan Karadzhov To: "rostedt@goodmis.org" CC: "linux-trace-devel@vger.kernel.org" Subject: [PATCH 1/2] kernel-shark-qt: Correct the coordinates of the Quick Context Menu Date: Fri, 30 Nov 2018 15:38:11 +0000 Message-ID: <20181130153749.4419-1-ykaradzhov@vmware.com> Content-Language: en-US MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 1099 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 --- 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); } } From patchwork Fri Nov 30 15:38:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 10760083 Return-Path: Received: from mail-eopbgr730080.outbound.protection.outlook.com ([40.107.73.80]:3348 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726595AbeLACr6 (ORCPT ); Fri, 30 Nov 2018 21:47:58 -0500 From: Yordan Karadzhov To: "rostedt@goodmis.org" CC: "linux-trace-devel@vger.kernel.org" Subject: [PATCH 2/2] kernel-shark-qt: Add better handling of the search iterator. Date: Fri, 30 Nov 2018 15:38:13 +0000 Message-ID: <20181130153749.4419-2-ykaradzhov@vmware.com> References: <20181130153749.4419-1-ykaradzhov@vmware.com> In-Reply-To: <20181130153749.4419-1-ykaradzhov@vmware.com> Content-Language: en-US MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 1482 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 --- 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()) {