The pen style defines the line type. The default pen style is TQt::SolidLine. Setting the style to NoPen tells the painter to not draw lines or outlines.
When drawing 1 pixel wide diagonal lines you can either use a very fast algorithm (specified by a line width of 0, which is the default), or a slower but more accurate algorithm (specified by a line width of 1). For horizontal and vertical lines a line width of 0 is the same as a line width of 1. The cap and join style have no effect on 0-width lines.
The cap style defines how the end points of lines are drawn. The join style defines how the joins between two lines are drawn when multiple connected lines are drawn (TQPainter::drawPolyline() etc.). The cap and join styles only apply to wide lines, i.e. when the width is 1 or greater.
With reference to the end points of lines, for wide (non-0-width) pens it depends on the cap style whether the end point is drawn or not. TQPainter will try to make sure that the end point is drawn for 0-width pens, but this cannot be absolutely guaranteed because the underlying drawing engine is free to use any (typically accelerated) algorithm for drawing 0-width lines. On all tested systems, however, the end point of at least all non-diagonal lines are drawn.
A pen's color(), width(), style(), capStyle() and joinStyle() can be set in the constructor or later with setColor(), setWidth(), setStyle(), setCapStyle() and setJoinStyle(). Pens may also be compared and streamed.
Constructs a pen with the specified color \fIcl\fR and width \fIw\fR. The pen style is set to \fIs\fR, the pen cap style to \fIc\fR and the pen join style to \fIj\fR.
.PP
A line width of 0 will produce a 1 pixel wide line using a fast algorithm for diagonals. A line width of 1 will also produce a 1 pixel wide line, but uses a slower more accurate algorithm for diagonals. For horizontal and vertical lines a line width of 0 is the same as a line width of 1. The cap and join style have no effect on 0-width lines.
\fBWarning:\fR On Mac OS X the style setting (other than NoPen and SolidLine) have no effect as they are not implemented by the underlying system.
.PP
\fBWarning:\fR On Windows 95/98, the style setting (other than NoPen and SolidLine) has no effect for lines with width greater than 1.
.PP
See also style().
.PP
Example: chart/chartform_canvas.cpp.
.SH "void QPen::setWidth ( uint w )"
Sets the pen width to \fIw\fR.
.PP
A line width of 0 will produce a 1 pixel wide line using a fast algorithm for diagonals. A line width of 1 will also produce a 1 pixel wide line, but uses a slower more accurate algorithm for diagonals. For horizontal and vertical lines a line width of 0 is the same as a line width of 1. The cap and join style have no effect on 0-width lines.
.PP
See also width().
.PP
Examples:
.)l multiple/ax2.h, progress/progress.cpp, and scribble/scribble.h.