structures.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:Laborejo 作者: hilbrichtsoftware 项目源码 文件源码
def stretchXCoordinates(self, factor):
        """Reposition the items on the X axis.
        Call goes through all parents/children, starting from ScoreView._stretchXCoordinates.
        Docstring there."""
        #The rects and lines here are just a QGraphicsRectItem and have no custom subclass. So they have no stretchXCoordinates itself.
        for item in self.items:
            item.setX(item.pos().x() * factor)
            item.stretchXCoordinates(factor)

        for staticItem in self.staticItems: #labels etc.
            staticItem.setX(staticItem.pos().x() * factor)

        for barline in self.barLines:
            barline.setX(barline.pos().x() * factor)

        for staffline in self.staffLines: #stafflines start from x=0. 0*factor=0 so we omit setPos
            stretchLine(staffline, factor)

        for beam in self.beams: #beams are part of the track, not of the note items.
            beam.setX(beam.pos().x() * factor )
            stretchRect(beam.rectangle, factor)

        for backgroundBlockColor in self.backgroundBlockColors:
            backgroundBlockColor.setX(backgroundBlockColor.pos().x() * factor)
            stretchRect(backgroundBlockColor, factor)

        for transparentBlockHandle in self.transparentBlockHandles:
            transparentBlockHandle.setX(transparentBlockHandle.pos().x() * factor)
            transparentBlockHandle.stretchXCoordinates(factor)

        for ccPath in self.ccPaths.values():
            ccPath.stretchXCoordinates(factor)

        self.lengthInPixel = self.lengthInPixel * factor #this also gets updated in createGraphicItemsFromData
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号