def createStaffLines(self, lengthInPixel = 0):
"""By default creates 5 stafflines. But it can be 10;
5 extra below the origin-staff.
This is NOT a double-system like a piano but just a staff
with more lines that happens to have the range of e.g.
treble + bass clef."""
def createLine(yOffset):
line = QtWidgets.QGraphicsLineItem(QtCore.QLineF(0, 0, lengthInPixel, 0))
line.setParentItem(self)
line.setPen(cosmeticPen)
self.staffLines.append(line)
line.setPos(0, yOffset*constantsAndConfigs.stafflineGap)
line.setZValue(-5) #This is the z value within GuiTrack
for l in self.staffLines:
self.parentScore.removeWhenIdle(l)
self.staffLines = []
lengthInPixel += 25 #a bonus that gives the hint that you can write after the last object.
for i in range(-2, 3): #the normal 5 line system. We have a lower and upper range/position. The middle line is at position 0
createLine(i)
if self.staticExportItem["double"]: #add more stuffs below (user-perspective. positive Qt values)
for i in range(4, 9): #i is now 3. Make a gap:
createLine(i)
评论列表
文章目录