当前位置: 首页>>代码示例>>Python>>正文


Python QPainterPath.pointAtPercent方法代码示例

本文整理汇总了Python中PySide.QtGui.QPainterPath.pointAtPercent方法的典型用法代码示例。如果您正苦于以下问题:Python QPainterPath.pointAtPercent方法的具体用法?Python QPainterPath.pointAtPercent怎么用?Python QPainterPath.pointAtPercent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PySide.QtGui.QPainterPath的用法示例。


在下文中一共展示了QPainterPath.pointAtPercent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: realRender

# 需要导入模块: from PySide.QtGui import QPainterPath [as 别名]
# 或者: from PySide.QtGui.QPainterPath import pointAtPercent [as 别名]
    def realRender(self, painter, renderPath):  # TODO/PORT: Still needs work.
        """
        TOWRITE

        :param `painter`: TOWRITE
        :type `painter`: `QPainter`_
        :param `renderPath`: TOWRITE
        :type `renderPath`: `QPainterPath`_
        """
        color1 = self.objectColor()  #QColor  # lighter color
        color2 = color1.darker(150)  #QColor  # darker color

        # If we have a dark color, lighten it
        darkness = color1.lightness() #int
        threshold = 32 #int   #TODO: This number may need adjusted or maybe just add it to settings.
        if darkness < threshold:
            color2 = color1
            if not darkness:
                color1 = QColor(threshold, threshold, threshold)  # lighter() does not affect pure black
            else :
                color1 = color2.lighter(100 + threshold)

        count = renderPath.elementCount()  # int
        for i in range(0, count - 1):  # for(int i = 0; i < count-1; ++i);

            elem = renderPath.elementAt(i)      # QPainterPath::Element
            next = renderPath.elementAt(i + 1)  # QPainterPath::Element

            if next.isMoveTo():
                continue

            elemPath = QPainterPath()
            elemPath.moveTo(elem.x, elem.y)
            elemPath.lineTo(next.x, next.y)

            renderPen = QPen(QColor(0, 0, 0, 0))
            renderPen.setWidthF(0)
            painter.setPen(renderPen)
            stroker = QPainterPathStroker()
            stroker.setWidth(0.35)
            stroker.setCapStyle(Qt.RoundCap)
            stroker.setJoinStyle(Qt.RoundJoin)
            realPath = stroker.createStroke(elemPath)  # QPainterPath
            painter.drawPath(realPath)

            grad = QLinearGradient(elemPath.pointAtPercent(0.5), elemPath.pointAtPercent(0.0))
            grad.setColorAt(0, color1)
            grad.setColorAt(1, color2)
            grad.setSpread(QGradient.ReflectSpread)

            painter.fillPath(realPath, QBrush(grad))
开发者ID:Metallicow,项目名称:Embroidermodder,代码行数:53,代码来源:object_base.py

示例2: set_shape

# 需要导入模块: from PySide.QtGui import QPainterPath [as 别名]
# 或者: from PySide.QtGui.QPainterPath import pointAtPercent [as 别名]
 def set_shape(self, width, height):
     ''' Define the symbol shape '''
     circ = min(width, height)
     path = QPainterPath()
     path.addEllipse(0, 0, circ, circ)
     point1 = path.pointAtPercent(0.625)
     point2 = path.pointAtPercent(0.125)
     point3 = path.pointAtPercent(0.875)
     point4 = path.pointAtPercent(0.375)
     path.moveTo(point1)
     path.lineTo(point2)
     path.moveTo(point3)
     path.lineTo(point4)
     self.setPath(path)
     # call Join superclass, otherwise symbol will take Join shape
     super(Join, self).set_shape(circ, circ)
开发者ID:Kampbell,项目名称:opengeode,代码行数:18,代码来源:sdlSymbols.py

示例3: reshape

# 需要导入模块: from PySide.QtGui import QPainterPath [as 别名]
# 或者: from PySide.QtGui.QPainterPath import pointAtPercent [as 别名]
 def reshape(self):
     ''' Update the connection or arrow shape '''
     shape = QPainterPath()
     shape.moveTo(self.start_point)
     for point in self.middle_points:
         shape.lineTo(point)
     shape.lineTo(self.end_point)
     # If required draw an arrow head (e.g. in SDL NEXTSTATE and JOIN)
     if self.child.arrow_head:
         self.draw_arrow_head(shape, origin='head',
                              kind=self.child.arrow_head)
     if self.child.arrow_tail:
         shape.moveTo(shape.pointAtPercent(0))
         self.draw_arrow_head(shape, origin='tail',
                              kind=self.child.arrow_head)
     self.setPath(shape)
开发者ID:dbrabera,项目名称:opengeode,代码行数:18,代码来源:Connectors.py


注:本文中的PySide.QtGui.QPainterPath.pointAtPercent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。