QPainterPathStroker Class Reference

[ QtGui module]

The QPainterPathStroker class is used to generate fillable outlines for a given painter path. 更多...

方法


详细描述

The QPainterPathStroker class is used to generate fillable outlines for a given painter path.

By calling the createStroke () function, passing a given QPainterPath as argument, a new painter path representing the outline of the given path is created. The newly created painter path can then be filled to draw the original painter path's outline.

You can control the various design aspects (width, cap styles, join styles and dash pattern) of the outlining using the following functions:

setDashPattern () function accepts both a Qt.PenStyle object and a vector representation of the pattern as argument.

In addition you can specify a curve's threshold, controlling the granularity with which a curve is drawn, using the setCurveThreshold () function. The default threshold is a well adjusted value (0.25), and normally you should not need to modify it. However, you can make the curve's appearance smoother by decreasing its value.

You can also control the miter limit for the generated outline 使用 setMiterLimit () function. The miter limit describes how far from each join the miter join can extend. The limit is specified in the units of width so the pixelwise miter limit will be miterlimit * width . This value is only used if the join style is Qt.MiterJoin .

The painter path generated by the createStroke () function should only be used for outlining the given painter path. Otherwise it may cause unexpected behavior. Generated outlines also require the Qt.WindingFill rule which is set by default.


方法文档编制

QPainterPathStroker.__init__ ( self )

Creates a new stroker.

Qt.PenCapStyle QPainterPathStroker.capStyle ( self )

Returns the cap style of the generated outlines.

另请参阅 setCapStyle ().

QPainterPath QPainterPathStroker.createStroke ( self , QPainterPath   path )

Generates a new path that is a fillable area representing the outline of the given path .

The various design aspects of the outline are based on the stroker's properties: width (), capStyle (), joinStyle (), dashPattern (), curveThreshold () 和 miterLimit ().

The generated path should only be used for outlining the given painter path. Otherwise it may cause unexpected behavior. Generated outlines also require the Qt.WindingFill rule which is set by default.

float QPainterPathStroker.curveThreshold ( self )

Returns the curve flattening threshold for the generated outlines.

另请参阅 setCurveThreshold ().

float QPainterPathStroker.dashOffset ( self )

Returns the dash offset for the generated outlines.

另请参阅 setDashOffset ().

list-of-float QPainterPathStroker.dashPattern ( self )

Returns the dash pattern for the generated outlines.

另请参阅 setDashPattern ().

Qt.PenJoinStyle QPainterPathStroker.joinStyle ( self )

Returns the join style of the generated outlines.

另请参阅 setJoinStyle ().

float QPainterPathStroker.miterLimit ( self )

Returns the miter limit for the generated outlines.

另请参阅 setMiterLimit ().

QPainterPathStroker.setCapStyle ( self , Qt.PenCapStyle   style )

Sets the cap style of the generated outlines to style 。若 a dash pattern is set, each segment of the pattern is subject to the cap style .

另请参阅 capStyle ().

QPainterPathStroker.setCurveThreshold ( self , float  threshold )

Specifies the curve flattening threshold , controlling the granularity with which the generated outlines' curve is drawn.

The default threshold is a well adjusted value (0.25), and normally you should not need to modify it. However, you can make the curve's appearance smoother by decreasing its value.

另请参阅 curveThreshold ().

QPainterPathStroker.setDashOffset ( self , float  offset )

Sets the dash offset for the generated outlines to offset .

See the documentation for QPen.setDashOffset () for a description of the dash offset.

另请参阅 dashOffset ().

QPainterPathStroker.setDashPattern ( self , Qt.PenStyle )

Sets the dash pattern for the generated outlines to style .

另请参阅 dashPattern ().

QPainterPathStroker.setDashPattern ( self , list-of-float  dashPattern )

这是重载函数。

Sets the dash pattern for the generated outlines to dashPattern . This function makes it possible to specify custom dash patterns.

Each element in the vector contains the lengths of the dashes and spaces in the stroke, beginning with the first dash in the first element, the first space in the second element, and alternating between dashes and spaces for each following pair of 元素。

The vector can contain an odd number of elements, in which case the last element will be extended by the length of the first element when the pattern repeats.

QPainterPathStroker.setJoinStyle ( self , Qt.PenJoinStyle   style )

Sets the join style of the generated outlines to style .

另请参阅 joinStyle ().

QPainterPathStroker.setMiterLimit ( self , float  length )

Sets the miter limit of the generated outlines to limit .

The miter limit describes how far from each join the miter join can extend. The limit is specified in units of the currently set width. So the pixelwise miter limit will be miterlimit * width .

This value is only used if the join style is Qt.MiterJoin .

另请参阅 miterLimit ().

QPainterPathStroker.setWidth ( self , float  width )

Sets the width of the generated outline painter path to width .

The generated outlines will extend approximately 50% of width to each side of the given input path's original outline.

另请参阅 width ().

float QPainterPathStroker.width ( self )

Returns the width of the generated outlines.

另请参阅 setWidth ().