Browse Source

Cleanup, try to fix canvas crash on mouse release

Signed-off-by: falkTX <falktx@gmail.com>
tags/v2.1-alpha2
falkTX 5 years ago
parent
commit
1c0371cf72
Signed by: falkTX <falktx@gmail.com> GPG Key ID: 2D3445A829213837
1 changed files with 2 additions and 9 deletions
  1. +2
    -9
      source/frontend/patchcanvas/canvasbox.py

+ 2
- 9
source/frontend/patchcanvas/canvasbox.py View File

@@ -61,7 +61,6 @@ from .canvasicon import CanvasIcon
from .canvasport import CanvasPort
from .theme import Theme
from .utils import CanvasItemFX, CanvasGetFullPortName, CanvasGetPortConnectionList
#from .canvasportglow import CanvasPortGlow

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

@@ -126,14 +125,12 @@ class CanvasBox(QGraphicsItem):
self.shadow = None

# Final touches
self.setFlags(QGraphicsItem.ItemIsMovable | QGraphicsItem.ItemIsSelectable)
self.setFlags(QGraphicsItem.ItemIsFocusable | QGraphicsItem.ItemIsMovable | QGraphicsItem.ItemIsSelectable)

# Wait for at least 1 port
if options.auto_hide_groups:
self.setVisible(False)

self.setFlag(QGraphicsItem.ItemIsFocusable, True)

if options.auto_select_items:
self.setAcceptHoverEvents(True)

@@ -516,15 +513,11 @@ class CanvasBox(QGraphicsItem):
def mouseReleaseEvent(self, event):
if self.m_cursor_moving:
self.unsetCursor()
self.fixPos()
QTimer.singleShot(0, self.fixPos)
self.m_mouse_down = False
self.m_cursor_moving = False
QGraphicsItem.mouseReleaseEvent(self, event)

def moveEvent(self, event):
if not self.m_mouse_down:
self.fixPos()

def fixPos(self):
self.setX(round(self.x()))
self.setY(round(self.y()))


Loading…
Cancel
Save