You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working on the WorldFrame where I inherit from QGraphicsView to display a QGraphicsObject (WorldView). I have already implemented the image zoom functionality from this post, and I have tried using their implementation of pan, and have found that it works. However, I want to be able to do the pan without toggling, simply by holding down the middle mouse button and dragging from there.
I've written this code to switch between the two modes (normal and drag), and then call it on mouse(Press/Release)Events.
(Sidenote: With the mouseReleaseEvent, I found that I couldn't use event.buttons() & Qt.MiddleButton to check if the middle button was released, so I always check and release in this case.)
However, whenever I try and middle-click and drag, no pan happens. However, I have confirmed this works correctly whenever I use the left mouse button as the binding (i.e. if event.buttons() & Qt.LeftButton: toggleDrag()). There has to be some code in QGraphicsView.mouseMoveEvent() that checks to see if the left button is held AND the cursor is in DragMode. Is there a way to change the keybinding on that deeper level?
EDIT: I just found this link and tried it by doing this (in QGraphicsView)
When working on the
WorldFrame
where I inherit fromQGraphicsView
to display aQGraphicsObject
(WorldView
). I have already implemented the image zoom functionality from this post, and I have tried using their implementation of pan, and have found that it works. However, I want to be able to do the pan without toggling, simply by holding down the middle mouse button and dragging from there.I've written this code to switch between the two modes (normal and drag), and then call it on
mouse(Press/Release)Events
.(in QGraphicsView)
(Sidenote: With the
mouseReleaseEvent
, I found that I couldn't useevent.buttons() & Qt.MiddleButton
to check if the middle button was released, so I always check and release in this case.)However, whenever I try and middle-click and drag, no pan happens. However, I have confirmed this works correctly whenever I use the left mouse button as the binding (i.e.
if event.buttons() & Qt.LeftButton: toggleDrag()
). There has to be some code inQGraphicsView.mouseMoveEvent()
that checks to see if the left button is held AND the cursor is in DragMode. Is there a way to change the keybinding on that deeper level?EDIT: I just found this link and tried it by doing this (in
QGraphicsView
)But to no avail. Still, it's an interesting lead.
Here's the stackoverflow question
The text was updated successfully, but these errors were encountered: