本文整理汇总了C++中QPainterPathStroker::width方法的典型用法代码示例。如果您正苦于以下问题:C++ QPainterPathStroker::width方法的具体用法?C++ QPainterPathStroker::width怎么用?C++ QPainterPathStroker::width使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPainterPathStroker
的用法示例。
在下文中一共展示了QPainterPathStroker::width方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getPathStroke
static QPainterPath getPathStroke(const QPainterPath &path, const RenderObject* object, const RenderStyle* style)
{
QPainterPathStroker s;
s.setWidth(KSVGPainterFactory::cssPrimitiveToLength(object, style->svgStyle()->strokeWidth(), 1.0));
if (style->svgStyle()->capStyle() == ButtCap)
s.setCapStyle(Qt::FlatCap);
else if (style->svgStyle()->capStyle() == RoundCap)
s.setCapStyle(Qt::RoundCap);
if (style->svgStyle()->joinStyle() == MiterJoin) {
s.setJoinStyle(Qt::MiterJoin);
s.setMiterLimit((qreal) style->svgStyle()->strokeMiterLimit());
} else if(style->svgStyle()->joinStyle() == RoundJoin)
s.setJoinStyle(Qt::RoundJoin);
const KCDashArray& dashes = KSVGPainterFactory::dashArrayFromRenderingStyle(style);
double dashOffset = KSVGPainterFactory::cssPrimitiveToLength(object, style->svgStyle()->strokeDashOffset(), 0.0);
unsigned int dashLength = !dashes.isEmpty() ? dashes.size() : 0;
if(dashLength) {
QVector<qreal> pattern;
unsigned int count = (dashLength % 2) == 0 ? dashLength : dashLength * 2;
for(unsigned int i = 0; i < count; i++)
pattern.append(dashes[i % dashLength] / (float)s.width());
s.setDashPattern(pattern);
Q_UNUSED(dashOffset);
// TODO: dash-offset, does/will qt4 API allow it? (Rob)
}
return s.createStroke(path);
}