Message ID | 20181130153749.4419-1-ykaradzhov@vmware.com (mailing list archive) |
---|---|
State | Accepted |
Commit | f79bf9059cf21d1c1d70d775e96a844159eec488 |
Headers | show |
Series | [1/2] kernel-shark-qt: Correct the coordinates of the Quick Context Menu | expand |
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); > } > }
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); } }
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(-)