Browse Source

Block Mode: Fix invisible block labels and graphics when dragging blocks (adopting to unannounced Qt regressions once again)

master
Nils 2 years ago
parent
commit
80f6673f54
  1. 3
      CHANGELOG
  2. 13
      qtgui/musicstructures.py
  3. 2
      qtgui/scorescene.py

3
CHANGELOG

@ -6,8 +6,9 @@ External contributors notice at the end of the line: (LastName, FirstName / nick
## 2022-10-15 2.2.0 ## 2022-10-15 2.2.0
Add more time signatures to the quick-insert dialog: 8/4, three variants of 7/8 and two variants of 5/4 and more. Also reorder and better labels. Add more time signatures to the quick-insert dialog: 8/4, three variants of 7/8, two variants of 5/4 and more. Also reorder and better labels.
Fix splitting of notes that were created by a previous split. Fix splitting of notes that were created by a previous split.
Block Mode: Fix invisible block labels and graphics when dragging blocks (adopting to unannounced Qt regressions once again)
Various small fixes, like typos in variable names and wrong string quotes. Small things can crash as well. Various small fixes, like typos in variable names and wrong string quotes. Small things can crash as well.
Lilypond: Lilypond:
Add transposition of the whole score to properties and metadata dialog Add transposition of the whole score to properties and metadata dialog

13
qtgui/musicstructures.py

@ -62,17 +62,19 @@ class GuiBlockHandle(QtWidgets.QGraphicsRectItem):
self.parent = parent #GuiTrack instance self.parent = parent #GuiTrack instance
self.parentGuiTrack = parent #redundant, but specifically for block movement. see ScoreScene self.parentGuiTrack = parent #redundant, but specifically for block movement. see ScoreScene
self.trans = QtGui.QColor("transparent") self.trans = QtGui.QColor("transparent")
self.setPen(self.trans) self.setPen(self.trans) #activate to show outline.
self.setBrush(self.trans) self.setBrush(self.trans)
#self.setOpacity(0.4) #slightly fuller than background #self.setOpacity(0.4) #slightly fuller than background
#self.setFlag(QtWidgets.QGraphicsItem.ItemIgnoresParentOpacity, True) #self.setFlag(QtWidgets.QGraphicsItem.ItemIgnoresParentOpacity, True)
#self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable, True) #self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable, True)
self.setParentItem(parent) self.setParentItem(parent)
self.setZValue(10) #This is the z value within GuiTrack #self.setZValue(10) #This is the z value within GuiTrack
self.staticExportItem = staticExportItem self.staticExportItem = staticExportItem
self._color = None # @property self._color = None # @property
self.posBeforeMove = None self.posBeforeMove = None
self.cursorPosOnMoveStart = None self.cursorPosOnMoveStart = None
self.setFlags(QtWidgets.QGraphicsItem.ItemIgnoresParentOpacity)
#Display Block ID #Display Block ID
""" """
@ -96,11 +98,13 @@ class GuiBlockHandle(QtWidgets.QGraphicsRectItem):
self.startLabel.setParentItem(self) self.startLabel.setParentItem(self)
self.startLabel.setPos(0, constantsAndConfigs.stafflineGap) self.startLabel.setPos(0, constantsAndConfigs.stafflineGap)
self.startLabel.setFlags(QtWidgets.QGraphicsItem.ItemIgnoresParentOpacity) self.startLabel.setFlags(QtWidgets.QGraphicsItem.ItemIgnoresParentOpacity)
#self.startLabel.setZValue(self.zValue()+1) this doesn't matter because our value is relative to self, the rectangle. And selfs value is relative to the GuiTracks other children.
self.endLabel.setParentItem(self) self.endLabel.setParentItem(self)
self.endLabel.setPos(self.rect().width() - self.endLabel.boundingRect().width(), constantsAndConfigs.stafflineGap) self.endLabel.setPos(self.rect().width() - self.endLabel.boundingRect().width(), constantsAndConfigs.stafflineGap)
self.endLabel.setFlags(QtWidgets.QGraphicsItem.ItemIgnoresParentOpacity) self.endLabel.setFlags(QtWidgets.QGraphicsItem.ItemIgnoresParentOpacity)
@property @property
def color(self): def color(self):
assert self._color assert self._color
@ -136,9 +140,10 @@ class GuiBlockHandle(QtWidgets.QGraphicsRectItem):
self.endLabel.hide() self.endLabel.hide()
def mousePressEventCustom(self, event): def mousePressEventCustom(self, event):
"""Not a qt-override. This is called directly by GuiScore """Not a qt-override. This is called directly by GuiScore
if you click on a block with the right modifier keys (none)""" if you click on a block"""
self.posBeforeMove = self.pos() self.posBeforeMove = self.pos()
self.cursorPosOnMoveStart = QtGui.QCursor.pos() self.cursorPosOnMoveStart = QtGui.QCursor.pos()
self.setBrush(self.color) self.setBrush(self.color)
@ -595,7 +600,7 @@ class GuiTrack(QtWidgets.QGraphicsItem):
elif nameAsString == "block": elif nameAsString == "block":
self.blockModeNameGraphic.show() self.blockModeNameGraphic.show()
self.nameGraphic.hide() self.nameGraphic.hide()
self.setOpacity(0) self.setOpacity(0) #this hides the notation stuff. The block mode graphics and labels are also children of ours, but they ignore parent opacity.
for backgroundColor in self.backgroundBlockColors: #simple QRectItems, they don't have their own updateMode function for backgroundColor in self.backgroundBlockColors: #simple QRectItems, they don't have their own updateMode function
backgroundColor.setOpacity(1) backgroundColor.setOpacity(1)
for tbh in self.transparentBlockHandles: for tbh in self.transparentBlockHandles:

2
qtgui/scorescene.py

@ -470,8 +470,6 @@ class GuiScore(QtWidgets.QGraphicsScene):
#GuiBlockHandles are children of a Track. Their Y position will be offset by the track when we move them around with the mouse. #GuiBlockHandles are children of a Track. Their Y position will be offset by the track when we move them around with the mouse.
#Which is the same the distance to the first track is on top. We need to substract that for a good look and feel. #Which is the same the distance to the first track is on top. We need to substract that for a good look and feel.
#The actual later dropping of the block is handled with the mouse cursor coordinates, the moving colored block is just eyecandy. #The actual later dropping of the block is handled with the mouse cursor coordinates, the moving colored block is just eyecandy.
#TODO: I want to scroll but this does not work because the item is wider than the viewport. It actually crashes qt
#self._mmE_ensureCursorVisible(event)
x = event.scenePos().x() x = event.scenePos().x()
y = event.scenePos().y() - self.duringBlockDragAndDrop.parentGuiTrack.y() y = event.scenePos().y() - self.duringBlockDragAndDrop.parentGuiTrack.y()
self.duringBlockDragAndDrop.setPos(x, y) self.duringBlockDragAndDrop.setPos(x, y)

Loading…
Cancel
Save