change MidButton to MiddleButton

the former is no longer present in Qt 6 as an alias
This commit is contained in:
KIU Shueng Chuan 2021-01-10 12:03:47 +08:00
parent 119c5fa3d0
commit f863390409
6 changed files with 8 additions and 8 deletions

View File

@ -207,7 +207,7 @@ class GraphicsScene(QtGui.QGraphicsScene):
now = ptime.time()
init = False
## keep track of which buttons are involved in dragging
for btn in [QtCore.Qt.LeftButton, QtCore.Qt.MidButton, QtCore.Qt.RightButton]:
for btn in [QtCore.Qt.LeftButton, QtCore.Qt.MiddleButton, QtCore.Qt.RightButton]:
if int(ev.buttons() & btn) == 0:
continue
if int(btn) not in self.dragButtons: ## see if we've dragged far enough yet

View File

@ -18,7 +18,7 @@ class MouseDragEvent(object):
self.currentItem = None
self._buttonDownScenePos = {}
self._buttonDownScreenPos = {}
for btn in [QtCore.Qt.LeftButton, QtCore.Qt.MidButton, QtCore.Qt.RightButton]:
for btn in [QtCore.Qt.LeftButton, QtCore.Qt.MiddleButton, QtCore.Qt.RightButton]:
self._buttonDownScenePos[int(btn)] = moveEvent.buttonDownScenePos(btn)
self._buttonDownScreenPos[int(btn)] = moveEvent.buttonDownScreenPos(btn)
self._scenePos = moveEvent.scenePos()

View File

@ -721,7 +721,7 @@ class ROI(GraphicsObject):
if self.translatable and ev.acceptDrags(QtCore.Qt.LeftButton):
hover=True
for btn in [QtCore.Qt.LeftButton, QtCore.Qt.RightButton, QtCore.Qt.MidButton]:
for btn in [QtCore.Qt.LeftButton, QtCore.Qt.RightButton, QtCore.Qt.MiddleButton]:
if int(self.acceptedMouseButtons() & btn) > 0 and ev.acceptClicks(btn):
hover=True
if self.contextMenuEnabled():
@ -731,7 +731,7 @@ class ROI(GraphicsObject):
self.setMouseHover(True)
ev.acceptClicks(QtCore.Qt.LeftButton) ## If the ROI is hilighted, we should accept all clicks to avoid confusion.
ev.acceptClicks(QtCore.Qt.RightButton)
ev.acceptClicks(QtCore.Qt.MidButton)
ev.acceptClicks(QtCore.Qt.MiddleButton)
self.sigHoverEvent.emit(self)
else:
self.setMouseHover(False)
@ -1342,7 +1342,7 @@ class Handle(UIGraphicsItem):
if not ev.isExit():
if ev.acceptDrags(QtCore.Qt.LeftButton):
hover=True
for btn in [QtCore.Qt.LeftButton, QtCore.Qt.RightButton, QtCore.Qt.MidButton]:
for btn in [QtCore.Qt.LeftButton, QtCore.Qt.RightButton, QtCore.Qt.MiddleButton]:
if int(self.acceptedMouseButtons() & btn) > 0 and ev.acceptClicks(btn):
hover=True

View File

@ -1243,7 +1243,7 @@ class ViewBox(GraphicsWidget):
mask[1-axis] = 0.0
## Scale or translate based on mouse button
if ev.button() & (QtCore.Qt.LeftButton | QtCore.Qt.MidButton):
if ev.button() & (QtCore.Qt.LeftButton | QtCore.Qt.MiddleButton):
if self.state['mouseMode'] == ViewBox.RectMode and axis is None:
if ev.isFinish(): ## This is the final move in the drag; change the view scale now
#print "finish"

View File

@ -421,7 +421,7 @@ class GLViewWidget(QtOpenGL.QGLWidget):
self.pan(diff.x(), diff.y(), 0, relative='view')
else:
self.orbit(-diff.x(), diff.y())
elif ev.buttons() == QtCore.Qt.MidButton:
elif ev.buttons() == QtCore.Qt.MiddleButton:
if (ev.modifiers() & QtCore.Qt.ControlModifier):
self.pan(diff.x(), 0, diff.y(), relative='view-upright')
else:

View File

@ -393,7 +393,7 @@ class GraphicsView(QtGui.QGraphicsView):
self.scale(scale[0], scale[1], center=self.mapToScene(self.mousePressPos))
self.sigDeviceRangeChanged.emit(self, self.range)
elif ev.buttons() in [QtCore.Qt.MidButton, QtCore.Qt.LeftButton]: ## Allow panning by left or mid button.
elif ev.buttons() in [QtCore.Qt.MiddleButton, QtCore.Qt.LeftButton]: ## Allow panning by left or mid button.
px = self.pixelSize()
tr = -delta * px