Browse Source

Allow to use canvas cut operations without prior window focus

Fixes #1176

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.3.0-RC1
falkTX 4 years ago
parent
commit
eb78e41ed9
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 5 additions and 13 deletions
  1. +4
    -0
      source/frontend/patchcanvas/scene.py
  2. +1
    -13
      source/frontend/widgets/draggablegraphicsview.py

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

@@ -280,6 +280,10 @@ class PatchScene(QGraphicsScene):
)
self.m_mouse_rubberband = False

# FIXME stop using self.m_ctrl_down
if event.modifiers() & Qt.ControlModifier:
self.m_ctrl_down = True

if event.button() == Qt.MidButton and self.m_ctrl_down:
self.m_mid_button_down = True
self.startConnectionCut()


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

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

self.fPanning = False
self.fCtrlDown = False

try:
self.fMiddleButton = Qt.MiddleButton
@@ -73,7 +72,6 @@ class DraggableGraphicsView(QGraphicsView):

def dragEnterEvent(self, event):
urls = event.mimeData().urls()
print(urls)

for url in urls:
if self.isDragUrlValid(url.toLocalFile()):
@@ -116,7 +114,7 @@ class DraggableGraphicsView(QGraphicsView):
# --------------------------------------------------------------------------------------------------------

def mousePressEvent(self, event):
if event.button() == self.fMiddleButton and not self.fCtrlDown:
if event.button() == self.fMiddleButton and not (event.modifiers() & Qt.ControlModifier):
buttons = event.buttons()
buttons &= ~self.fMiddleButton
buttons |= Qt.LeftButton
@@ -154,13 +152,3 @@ class DraggableGraphicsView(QGraphicsView):
QGraphicsView.wheelEvent(self, event)

# --------------------------------------------------------------------------------------------------------

def keyPressEvent(self, event):
if event.key() == Qt.Key_Control:
self.fCtrlDown = True
QGraphicsView.keyPressEvent(self, event)

def keyReleaseEvent(self, event):
if event.key() == Qt.Key_Control:
self.fCtrlDown = False
QGraphicsView.keyReleaseEvent(self, event)

Loading…
Cancel
Save