Browse Source

More consistent names for some variables

Mouse buttons in nix world have numbers 1..3 for 3 primary buttons, but
qt has special meaning for numbered names, using symbolics for first
standard buttons.
tags/v1.9.9
Nikita Zlobin Filipe Coelho <falktx@falktx.com> 7 years ago
parent
commit
98ea1d800c
2 changed files with 6 additions and 6 deletions
  1. +4
    -4
      source/patchcanvas.py
  2. +2
    -2
      source/widgets/draggablegraphicsview.py

+ 4
- 4
source/patchcanvas.py View File

@@ -1214,7 +1214,7 @@ class PatchScene(QGraphicsScene):
self.m_ctrl_down = False
self.m_mouse_down_init = False
self.m_mouse_rubberband = False
self.m_mouse2_down = False
self.m_mid_button_down = False
self.pointer_border = QRectF(0.0, 0.0, 1.0, 1.0)

self.addRubberBand()
@@ -1368,7 +1368,7 @@ class PatchScene(QGraphicsScene):
self.m_mouse_down_init = bool(event.button() == Qt.LeftButton)
self.m_mouse_rubberband = False
if event.button() == Qt.MidButton and self.m_ctrl_down:
self.m_mouse2_down = True
self.m_mid_button_down = True
pos = event.scenePos()
self.pointer_border.moveTo(floor(pos.x()), floor(pos.y()))

@@ -1404,7 +1404,7 @@ class PatchScene(QGraphicsScene):
self.m_rubberband.setRect(x, y, abs(pos.x() - self.m_rubberband_orig_point.x()), abs(pos.y() - self.m_rubberband_orig_point.y()))
return event.accept()

if self.m_mouse2_down and self.m_ctrl_down:
if self.m_mid_button_down and self.m_ctrl_down:
trail = QPolygonF([event.scenePos(), event.lastScenePos(), event.scenePos()])
items = self.items(trail)
for item in items:
@@ -1415,7 +1415,7 @@ class PatchScene(QGraphicsScene):

def mouseReleaseEvent(self, event):
if event.button() == Qt.MidButton:
self.m_mouse2_down = False
self.m_mid_button_down = False
return event.accept()

if self.m_rubberband_selection:


+ 2
- 2
source/widgets/draggablegraphicsview.py View File

@@ -40,7 +40,7 @@ class DraggableGraphicsView(QGraphicsView):
QGraphicsView.__init__(self, parent)

self.fPanning = False
self.m_ctrl_down = False
self.fCtrlDown = False

try:
self.fMiddleButton = Qt.MiddleButton
@@ -48,7 +48,7 @@ class DraggableGraphicsView(QGraphicsView):
self.fMiddleButton = Qt.MidButton

def mousePressEvent(self, event):
if event.button() == self.fMiddleButton and not self.m_ctrl_down:
if event.button() == self.fMiddleButton and not self.fCtrlDown:
self.fPanning = True
self.setDragMode(QGraphicsView.ScrollHandDrag)
event = QMouseEvent(event.type(), event.pos(), Qt.LeftButton, Qt.LeftButton, event.modifiers())


Loading…
Cancel
Save