|
|
@ -58,7 +58,6 @@ class GuiBlockHandle(QtWidgets.QGraphicsRectItem): |
|
|
|
#self.setFlag(QtWidgets.QGraphicsItem.ItemContainsChildrenInShape, True) |
|
|
|
self.parent = parent #GuiTrack instance |
|
|
|
self.parentGuiTrack = parent #redundant, but specifically for block movement. see ScoreScene |
|
|
|
self.color = None #QColor inserted by the creating function in GuiTrack. Used during dragging, then reset to transparent. |
|
|
|
self.trans = QtGui.QColor("transparent") |
|
|
|
self.setPen(self.trans) |
|
|
|
self.setBrush(self.trans) |
|
|
@ -68,7 +67,7 @@ class GuiBlockHandle(QtWidgets.QGraphicsRectItem): |
|
|
|
self.setParentItem(parent) |
|
|
|
self.setZValue(10) #This is the z value within GuiTrack |
|
|
|
self.staticExportItem = staticExportItem |
|
|
|
|
|
|
|
self._color = None # @property |
|
|
|
self.posBeforeMove = None |
|
|
|
self.cursorPosOnMoveStart = None |
|
|
|
|
|
|
@ -99,6 +98,25 @@ class GuiBlockHandle(QtWidgets.QGraphicsRectItem): |
|
|
|
self.endLabel.setPos(self.rect().width() - self.endLabel.boundingRect().width(), constantsAndConfigs.stafflineGap) |
|
|
|
self.endLabel.setFlags(QtWidgets.QGraphicsItem.ItemIgnoresParentOpacity) |
|
|
|
|
|
|
|
@property |
|
|
|
def color(self): |
|
|
|
assert self._color |
|
|
|
return self._color |
|
|
|
|
|
|
|
@color.setter |
|
|
|
def color(self, c:QtGui.QColor): |
|
|
|
"""QColor inserted by the creating function in GuiTrack. |
|
|
|
Only available during mousePressEvent. Used during dragging, then reset to transparent. |
|
|
|
|
|
|
|
This is on every change. Every note.""" |
|
|
|
self._color = c |
|
|
|
if c.lightness() > 127: #between 0 (for black) and 255 (for white) |
|
|
|
labelColor = QtGui.QColor("black") |
|
|
|
else: |
|
|
|
labelColor = QtGui.QColor("white") |
|
|
|
self.startLabel.setBrush(labelColor) |
|
|
|
self.endLabel.setBrush(labelColor) |
|
|
|
|
|
|
|
def stretchXCoordinates(self, factor): |
|
|
|
"""Reposition the items on the X axis. |
|
|
|
Call goes through all parents/children, starting from ScoreView._stretchXCoordinates. |
|
|
@ -114,6 +132,7 @@ class GuiBlockHandle(QtWidgets.QGraphicsRectItem): |
|
|
|
self.startLabel.hide() |
|
|
|
self.endLabel.hide() |
|
|
|
|
|
|
|
|
|
|
|
def mousePressEventCustom(self, event): |
|
|
|
"""Not a qt-override. This is called directly by GuiScore |
|
|
|
if you click on a block with the right modifier keys (none)""" |
|
|
@ -143,8 +162,6 @@ class GuiBlockHandle(QtWidgets.QGraphicsRectItem): |
|
|
|
We do not use event parameter. This is for compatibility. |
|
|
|
""" |
|
|
|
if self.startLabel.isVisible(): #block mode |
|
|
|
print (self.staticExportItem["name"], event) |
|
|
|
|
|
|
|
listOfLabelsAndFunctions = [ |
|
|
|
(translate("musicstructures", "edit properties"), lambda: BlockPropertiesEdit(self.scene().parentView.mainWindow, staticExportItem = self.staticExportItem)), |
|
|
|
("separator", None), |
|
|
|