summaryrefslogtreecommitdiffstats
path: root/doc/man/man3/tqpen.3qt
blob: 9ce81f70aec5df953a60aba389f75d4ae78e0f3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
'\" t
.TH QPen 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA.  All rights reserved.  See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QPen \- Defines how a QPainter should draw lines and outlines of shapes
.SH SYNOPSIS
\fC#include <ntqpen.h>\fR
.PP
Inherits Qt.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQPen\fR ()"
.br
.ti -1c
.BI "\fBQPen\fR ( PenStyle style )"
.br
.ti -1c
.BI "\fBQPen\fR ( const TQColor & color, uint width = 0, PenStyle style = SolidLine )"
.br
.ti -1c
.BI "\fBQPen\fR ( const TQColor & cl, uint w, PenStyle s, PenCapStyle c, PenJoinStyle j )"
.br
.ti -1c
.BI "\fBQPen\fR ( const QPen & p )"
.br
.ti -1c
.BI "\fB~QPen\fR ()"
.br
.ti -1c
.BI "QPen & \fBoperator=\fR ( const QPen & p )"
.br
.ti -1c
.BI "PenStyle \fBstyle\fR () const"
.br
.ti -1c
.BI "void \fBsetStyle\fR ( PenStyle s )"
.br
.ti -1c
.BI "uint \fBwidth\fR () const"
.br
.ti -1c
.BI "void \fBsetWidth\fR ( uint w )"
.br
.ti -1c
.BI "const TQColor & \fBcolor\fR () const"
.br
.ti -1c
.BI "void \fBsetColor\fR ( const TQColor & c )"
.br
.ti -1c
.BI "PenCapStyle \fBcapStyle\fR () const"
.br
.ti -1c
.BI "void \fBsetCapStyle\fR ( PenCapStyle c )"
.br
.ti -1c
.BI "PenJoinStyle \fBjoinStyle\fR () const"
.br
.ti -1c
.BI "void \fBsetJoinStyle\fR ( PenJoinStyle j )"
.br
.ti -1c
.BI "bool \fBoperator==\fR ( const QPen & p ) const"
.br
.ti -1c
.BI "bool \fBoperator!=\fR ( const QPen & p ) const"
.br
.in -1c
.SH RELATED FUNCTION DOCUMENTATION
.in +1c
.ti -1c
.BI "QDataStream & \fBoperator<<\fR ( QDataStream & s, const QPen & p )"
.br
.ti -1c
.BI "QDataStream & \fBoperator>>\fR ( QDataStream & s, QPen & p )"
.br
.in -1c
.SH DESCRIPTION
The QPen class defines how a QPainter should draw lines and outlines of shapes.
.PP
A pen has a style, width, color, cap style and join style.
.PP
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.
.PP
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.
.PP
The pen color defines the color of lines and text. The default line color is black. The TQColor documentation lists predefined colors.
.PP
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 (QPainter::drawPolyline() etc.). The cap and join styles only apply to wide lines, i.e. when the width is 1 or greater.
.PP
Use the QBrush class to specify fill styles.
.PP
Example:
.PP
.nf
.br
    QPainter painter;
.br
    QPen     pen( red, 2 );             // red solid line, 2 pixels wide
.br
    painter.begin( &anyPaintDevice );   // paint something
.br
    painter.setPen( pen );              // set the red, wide pen
.br
    painter.drawRect( 40,30, 200,100 ); // draw a rectangle
.br
    painter.setPen( blue );             // set blue pen, 0 pixel width
.br
    painter.drawLine( 40,30, 240,130 ); // draw a diagonal in rectangle
.br
    painter.end();                      // painting done
.br
.fi
.PP
See the TQt::PenStyle enum type for a complete list of pen styles.
.PP
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. QPainter 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.
.PP
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.
.PP
<center>
.ce 1
.B "[Image Omitted]"
.PP
</center>
.PP
See also QPainter, QPainter::setPen(), Graphics Classes, Image Processing Classes, and Implicitly and Explicitly Shared Classes.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QPen::QPen ()"
Constructs a default black solid line pen with 0 width, which renders lines 1 pixel wide (fast diagonals).
.SH "QPen::QPen ( PenStyle style )"
Constructs a black pen with 0 width (fast diagonals) and style \fIstyle\fR.
.PP
See also setStyle().
.SH "QPen::QPen ( const TQColor & color, uint width = 0, PenStyle style = SolidLine )"
Constructs a pen with the specified \fIcolor\fR, \fIwidth\fR and \fIstyle\fR.
.PP
See also setWidth(), setStyle(), and setColor().
.SH "QPen::QPen ( const TQColor & cl, uint w, PenStyle s, PenCapStyle c, PenJoinStyle j )"
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.
.PP
See also setWidth(), setStyle(), and setColor().
.SH "QPen::QPen ( const QPen & p )"
Constructs a pen that is a copy of \fIp\fR.
.SH "QPen::~QPen ()"
Destroys the pen.
.SH "PenCapStyle QPen::capStyle () const"
Returns the pen's cap style.
.PP
See also setCapStyle().
.SH "const TQColor & QPen::color () const"
Returns the pen color.
.PP
See also setColor().
.PP
Example: scribble/scribble.h.
.SH "PenJoinStyle QPen::joinStyle () const"
Returns the pen's join style.
.PP
See also setJoinStyle().
.SH "bool QPen::operator!= ( const QPen & p ) const"
Returns TRUE if the pen is different from \fIp\fR; otherwise returns FALSE.
.PP
Two pens are different if they have different styles, widths or colors.
.PP
See also operator==().
.SH "QPen & QPen::operator= ( const QPen & p )"
Assigns \fIp\fR to this pen and returns a reference to this pen.
.SH "bool QPen::operator== ( const QPen & p ) const"
Returns TRUE if the pen is equal to \fIp\fR; otherwise returns FALSE.
.PP
Two pens are equal if they have equal styles, widths and colors.
.PP
See also operator!=().
.SH "void QPen::setCapStyle ( PenCapStyle c )"
Sets the pen's cap style to \fIc\fR.
.PP
The default value is FlatCap. The cap style has no effect on 0-width pens.
.PP
<center>
.ce 1
.B "[Image Omitted]"
.PP
</center>
.PP
\fBWarning:\fR On Windows 95/98 and Macintosh, the cap style setting has no effect. Wide lines are rendered as if the cap style was SquareCap.
.PP
See also capStyle().
.PP
Example: themes/wood.cpp.
.SH "void QPen::setColor ( const TQColor & c )"
Sets the pen color to \fIc\fR.
.PP
See also color().
.PP
Examples:
.)l progress/progress.cpp and scribble/scribble.h.
.SH "void QPen::setJoinStyle ( PenJoinStyle j )"
Sets the pen's join style to \fIj\fR.
.PP
The default value is MiterJoin. The join style has no effect on 0-width pens.
.PP
<center>
.ce 1
.B "[Image Omitted]"
.PP
</center>
.PP
\fBWarning:\fR On Windows 95/98 and Macintosh, the join style setting has no effect. Wide lines are rendered as if the join style was BevelJoin.
.PP
See also joinStyle().
.PP
Example: themes/wood.cpp.
.SH "void QPen::setStyle ( PenStyle s )"
Sets the pen style to \fIs\fR.
.PP
See the TQt::PenStyle documentation for a list of all the styles.
.PP
\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.
.SH "PenStyle QPen::style () const"
Returns the pen style.
.PP
See also setStyle().
.SH "uint QPen::width () const"
Returns the pen width.
.PP
See also setWidth().
.PP
Example: scribble/scribble.h.
.SH RELATED FUNCTION DOCUMENTATION
.SH "QDataStream & operator<< ( QDataStream & s, const QPen & p )"
Writes the pen \fIp\fR to the stream \fIs\fR and returns a reference to the stream.
.PP
See also Format of the QDataStream operators.
.SH "QDataStream & operator>> ( QDataStream & s, QPen & p )"
Reads a pen from the stream \fIs\fR into \fIp\fR and returns a reference to the stream.
.PP
See also Format of the QDataStream operators.

.SH "SEE ALSO"
.BR http://doc.trolltech.com/ntqpen.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive TQt documentation is provided in HTML format; it is
located at $TQTDIR/doc/html and can be read using TQt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech. 
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (tqpen.3qt) and the Qt
version (3.3.8).