ifevent.button()==1and0<=event.scenePos().x()<self.staffLine.line().x2():#within the conductor line: # QtCore.Qt.MouseButton.LeftButton
ifself.parentView.mode()in("notation","cc")andevent.button()==QtCore.Qt.LeftButtonand0<=event.scenePos().x()<self.staffLine.line().x2():#within the conductor line.
event.accept()
self.add(event.scenePos())#create a new tempo point by telling the api a position and then reacting to "delete all, recreate" from the callback.
else:
@ -204,7 +204,7 @@ class ConductorTransparentBlock(QtWidgets.QGraphicsRectItem):
self.trans=QtGui.QColor("transparent")
self.setPen(self.trans)
self.setBrush(self.color)
self.setOpacity(0.2)#mimic background behaviour
self.setOpacity(0.5)#mimic background behaviour
self.staticExportItem=staticExportItem
self.posBeforeMove=None
self.cursorPosOnMoveStart=None
@ -242,57 +242,18 @@ class ConductorTransparentBlock(QtWidgets.QGraphicsRectItem):
stretchRect(self,factor)
self.marker.setX(self.marker.pos().x()*factor)
defmouseMoveEvent(self,event):
"""Don't use the qt system. we move ourselves"""
event.accept()
defmousePressEvent(self,event):
"""Just reroute to the parent score so that mousePressEventCustom can get triggered"""
#event.ignore() #this blocks the qt movable object since we already move the object on our own.
"""
super().mouseMoveEvent(event)
defmousePressEventCustom(self,event):
"""Custom gets called by the scene mouse press event directly only when the right keys
areholddown"""
"""Custom gets called by the scene mouse press event"""
self.posBeforeMove=self.pos()
self.cursorPosOnMoveStart=QtGui.QCursor.pos()
#self.setBrush(self.color)
super().mousePressEvent(event)
defmouseReleaseEventCustom(self,event):
"""Custom gets called by the scene mouse press event directly only when the right keys
areholddown"""
#self.setBrush(self.trans)
self.setPos(self.posBeforeMove)#In case the block was moved to a position where no track is (below the tracks) we just reset the graphics. If the moving was correct then the new position will be set by redrawing the whole Conductor.
self.posBeforeMove=None
@ -307,7 +268,7 @@ class ConductorTransparentBlock(QtWidgets.QGraphicsRectItem):
@ -335,7 +296,6 @@ class ConductorBlockHandle(QtWidgets.QGraphicsRectItem):
super().__init__(-3,-2,3,parent.rect().height())#x, y, w, h
self.setFlags(QtWidgets.QGraphicsItem.ItemIsMovable|QtWidgets.QGraphicsItem.ItemSendsGeometryChanges|QtWidgets.QGraphicsItem.ItemIsFocusable|QtWidgets.QGraphicsItem.ItemIgnoresParentOpacity)#QtWidgets.QGraphicsItem.ItemClipsToShape puts the item behind the parent rect and only receives event inside its own shape.
self.setAcceptHoverEvents(True)
self.setCursor(QtCore.Qt.SizeHorCursor)
self.setZValue(_zValuesRelativeToConductor["handle"])#The handle does not compete with the transparent block but with its contents! Therefore the startItem is set to have a custom lower priority than the handle
self.setBrush(QtGui.QColor("black"))
@ -361,21 +321,27 @@ class ConductorBlockHandle(QtWidgets.QGraphicsRectItem):
returnpath
defhoverEnterEvent(self,event):
ifself.parentTransparentBlock.parent.parentView.mode()in("notation","cc"):#Blockmode is for moving around. not resizing.
#after delete the item and tempo tracks gets recreated so we need to reactivate the shortcut now. It will work without these two lines, but that is only implicit behaviour.
@ -540,14 +523,19 @@ class TempoPoint(QtWidgets.QGraphicsItem):