|
|
@ -341,28 +341,42 @@ class GuiScore(QtWidgets.QGraphicsScene): |
|
|
|
and drop. We make the mouse cursor invisible so the user |
|
|
|
can see where the object is moving |
|
|
|
""" |
|
|
|
if event.button() == QtCore.Qt.LeftButton and self.parentView.mode() in ("block", "cc"): |
|
|
|
modifiers = QtWidgets.QApplication.keyboardModifiers() |
|
|
|
super().mousePressEvent(event) |
|
|
|
|
|
|
|
if self.parentView.mode() in ("block", "cc"): |
|
|
|
if event.button() == QtCore.Qt.LeftButton: |
|
|
|
modifiers = QtWidgets.QApplication.keyboardModifiers() |
|
|
|
|
|
|
|
#Block Move |
|
|
|
if modifiers == QtCore.Qt.NoModifier: |
|
|
|
#Block Move |
|
|
|
if modifiers == QtCore.Qt.NoModifier: |
|
|
|
block = self.blockAt(event.scenePos()) |
|
|
|
if block: #works for note blocks and conductor blocks |
|
|
|
#block is type GuiBlockHandle |
|
|
|
block.staticExportItem["guiPosStart"] = block.pos() #without shame we hijack the backend-dict. |
|
|
|
self.duringBlockDragAndDrop = block |
|
|
|
block.mousePressEventCustom(event) |
|
|
|
|
|
|
|
#Track Move |
|
|
|
elif (modifiers == QtCore.Qt.AltModifier or modifiers == QtCore.Qt.ShiftModifier ) and self.parentView.mode() == "block": |
|
|
|
track = self.trackAt(event.scenePos()) |
|
|
|
if track and not track is self.conductor: |
|
|
|
self.parentView.setCursor(QtCore.Qt.BlankCursor) |
|
|
|
self.cursor.hide() |
|
|
|
track.staticExportItem["guiPosStart"] = track.pos() |
|
|
|
self.duringTrackDragAndDrop = track |
|
|
|
|
|
|
|
elif event.button() == QtCore.Qt.RightButton: |
|
|
|
"""Fake context menu event. The built-in one never got |
|
|
|
the correct detection. Yes, this will hardcode the |
|
|
|
context menu to right mouse button, which is not really |
|
|
|
the only way to trigger a context menu. However, too |
|
|
|
much time has been spent to get this right already. |
|
|
|
Good enough is better than good.""" |
|
|
|
block = self.blockAt(event.scenePos()) |
|
|
|
if block: #works for note blocks and conductor blocks |
|
|
|
#block is type GuiBlockHandle |
|
|
|
block.staticExportItem["guiPosStart"] = block.pos() #without shame we hijack the backend-dict. |
|
|
|
self.duringBlockDragAndDrop = block |
|
|
|
block.mousePressEventCustom(event) |
|
|
|
|
|
|
|
#Track Move |
|
|
|
elif (modifiers == QtCore.Qt.AltModifier or modifiers == QtCore.Qt.ShiftModifier ) and self.parentView.mode() == "block": |
|
|
|
track = self.trackAt(event.scenePos()) |
|
|
|
if track and not track is self.conductor: |
|
|
|
self.parentView.setCursor(QtCore.Qt.BlankCursor) |
|
|
|
self.cursor.hide() |
|
|
|
track.staticExportItem["guiPosStart"] = track.pos() |
|
|
|
self.duringTrackDragAndDrop = track |
|
|
|
block.contextMenuEventCustom() |
|
|
|
|
|
|
|
|
|
|
|
super().mousePressEvent(event) |
|
|
|
|
|
|
|
def mouseMoveEvent(self, event): |
|
|
|
"""Catches certain mouse events for moving tracks and blocks. |
|
|
@ -395,7 +409,7 @@ class GuiScore(QtWidgets.QGraphicsScene): |
|
|
|
Don't forget that an item needs to have the flag movable or selectable or else |
|
|
|
it will not get mouseRelease or mouseMove events. MousePress always works.""" |
|
|
|
|
|
|
|
self.parentView.unsetCursor() #While moving stuff the mouse-cursor is hidden. Reset. |
|
|
|
#self.parentView.unsetCursor() #While moving stuff the mouse-cursor is hidden. Reset. |
|
|
|
#self.cursor.show() #Our own position cursor #TODO: why was that in here? It shows the cursor after a mouseclick, even in CC mode (it should not) |
|
|
|
|
|
|
|
tempBlockDragAndDrop = self.duringBlockDragAndDrop |
|
|
|