Qt学习 第23节:QPen 和 QBrush

strokes :(铅笔、刷子的)一笔,一挥,笔画 ,
n.击球(动作);(打、击等的)一下,一击;划水动作;划桨动作
v.轻抚,抚摩(动物的毛皮);抚摩(物体表面或头发等);轻挪;轻触;轻拭

 The pen style defines the line type. The brush is used to fill strokes generated with the pen

 QPainter painter(this);
 QPen pen(Qt::green, 3, Qt::DashDotLine, Qt::RoundCap, Qt::RoundJoin);
 painter.setPen(pen);
which is equivalent to
 QPainter painter(this);
 QPen pen;  // creates a default pen

 pen.setStyle(Qt::DashDotLine);
 pen.setWidth(3);
 pen.setBrush(Qt::green);
 pen.setCapStyle(Qt::RoundCap);
 pen.setJoinStyle(Qt::RoundJoin);

 painter.setPen(pen);

The QPen class defines how a QPainter should draw lines and outlines of shapes. 

 Qt::PenStyle

Qt学习 第23节:QPen 和 QBrush_第1张图片

Qt::NoPen 0 no line at all. For example, QPainter::drawRect() fills but does not draw any boundary line.
Qt::SolidLine 1 A plain line.
Qt::DashLine 2 Dashes separated by a few pixels.
Qt::DotLine 3 Dots separated by a few pixels.
Qt::DashDotLine 4 Alternate dots and dashes.
Qt::DashDotDotLine 5 One dash, two dots, one dash, two dots.
Qt::CustomDashLine 6 A custom pattern defined using QPainterPathStroker::setDashPattern().

 The QBrush class defines the fill pattern of shapes drawn by QPainter

Qt::BrushStyle 

Qt学习 第23节:QPen 和 QBrush_第2张图片

你可能感兴趣的:(Qt,qt,开发语言)