viewBox position of mouse click for context menu?

52 views
Skip to first unread message

Jameson Rollins

unread,
Jan 23, 2024, 3:18:00 PMJan 23
to pyqt...@googlegroups.com
Hello. I would like to add a plot/viewbox context menu action that uses
the current position in the plot where the right click occurred. The
popup gets what appears to be the point in the global coordinate system,
but I'm at a loss on how to map it to the viewBox position. Everything
I've tried (e.g. vb.mapSceneToView, mapFromGlobal, etc) doesn't work
(i.e. either fails or doesn't produce the correct point). Does anyone
have any suggestions on how to achieve this? Thanks in advance.

jamie.

Martin Chase

unread,
Feb 21, 2024, 5:43:49 PMFeb 21
to pyqt...@googlegroups.com
At a guess, the viewBox is also in the global coordinate system, and what you want is the position of a plot within that viewbox? Can you put your click handler on an object further down inside your coordinates? Maybe by emitting an event from your viewBox or by building out the mouseClickEvent method on that inner object?
Good luck,
 - Martin
Reply all
Reply to author
Forward
0 new messages