Browse Source

Make canvas ports and groups ignore middle mouse clicks

Fixes #1085

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.2.0-RC1
falkTX 4 years ago
parent
commit
62b91cbe9a
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 10 additions and 1 deletions
  1. +4
    -0
      source/frontend/patchcanvas/canvasbox.py
  2. +4
    -0
      source/frontend/patchcanvas/canvasport.py
  3. +2
    -1
      source/frontend/widgets/draggablegraphicsview.py

+ 4
- 0
source/frontend/patchcanvas/canvasbox.py View File

@@ -612,6 +612,10 @@ class CanvasBox(QGraphicsObject):
QGraphicsObject.mouseDoubleClickEvent(self, event)

def mousePressEvent(self, event):
if event.button() == Qt.MiddleButton or event.source() == Qt.MouseEventSynthesizedByApplication:
event.ignore()
return

canvas.last_z_value += 1
self.setZValue(canvas.last_z_value)
self.resetLinesZValue()


+ 4
- 0
source/frontend/patchcanvas/canvasport.py View File

@@ -147,6 +147,10 @@ class CanvasPort(QGraphicsItem):
QGraphicsItem.hoverLeaveEvent(self, event)

def mousePressEvent(self, event):
if event.button() == Qt.MiddleButton or event.source() == Qt.MouseEventSynthesizedByApplication:
event.ignore()
return

if self.m_mouse_down:
self.handleMouseRelease()
self.m_hover_item = None


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

@@ -119,7 +119,8 @@ class DraggableGraphicsView(QGraphicsView):
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())
event = QMouseEvent(event.type(), event.localPos(), event.windowPos(), event.screenPos(),
Qt.LeftButton, Qt.LeftButton, event.modifiers(), Qt.MouseEventSynthesizedByApplication)

QGraphicsView.mousePressEvent(self, event)



Loading…
Cancel
Save