File: qpen.html

package info (click to toggle)
qt-embedded 2.3.2-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 68,608 kB
  • ctags: 45,998
  • sloc: cpp: 276,654; ansic: 71,987; makefile: 29,074; sh: 12,305; yacc: 2,465; python: 1,863; perl: 481; lex: 480; xml: 68; lisp: 15
file content (191 lines) | stat: -rw-r--r-- 12,272 bytes parent folder | download
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QPen Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">

<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>

<h1 align=center>QPen Class Reference</h1><br clear="all">
<p>
The QPen class defines how a <a href="qpainter.html">QPainter</a> should draw lines and outlines of shapes.
<a href="#details">More...</a>
<p>
<code>#include &lt;<a href="qpen-h.html">qpen.h</a>&gt;</code>
<p>
Inherits <a href="qt.html">Qt</a>.
<p><a href="qpen-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#171192"><b>QPen</b></a>()</div>
<li><div class="fn"><a href="#90cf48"><b>QPen</b></a>(PenStyle)</div>
<li><div class="fn"><a href="#1e24bd"><b>QPen</b></a>(constQColor&amp;color, uintwidth=0, PenStylestyle=SolidLine)</div>
<li><div class="fn"><a href="#679c79"><b>QPen</b></a>(constQColor&amp;cl, uintw, PenStyles, PenCapStylec, PenJoinStylej)</div>
<li><div class="fn"><a href="#b56f1c"><b>QPen</b></a>(constQPen&amp;)</div>
<li><div class="fn"><a href="#2d9c9a"><b>~QPen</b></a>()</div>
<li><div class="fn">QPen&amp;<a href="#7ce458"><b>operator=</b></a>(constQPen&amp;)</div>
<li><div class="fn">PenStyle<a href="#e2fb15"><b>style</b></a>()const</div>
<li><div class="fn">void<a href="#62894c"><b>setStyle</b></a>(PenStyle)</div>
<li><div class="fn">uint<a href="#7bedc6"><b>width</b></a>()const</div>
<li><div class="fn">void<a href="#6a009f"><b>setWidth</b></a>(uint)</div>
<li><div class="fn">constQColor&amp;<a href="#0db022"><b>color</b></a>()const</div>
<li><div class="fn">void<a href="#00d674"><b>setColor</b></a>(constQColor&amp;)</div>
<li><div class="fn">PenCapStyle<a href="#0adb18"><b>capStyle</b></a>()const</div>
<li><div class="fn">void<a href="#23e021"><b>setCapStyle</b></a>(PenCapStyle)</div>
<li><div class="fn">PenJoinStyle<a href="#0cc1c8"><b>joinStyle</b></a>()const</div>
<li><div class="fn">void<a href="#43cd4a"><b>setJoinStyle</b></a>(PenJoinStyle)</div>
<li><div class="fn">bool<a href="#7a1a86"><b>operator==</b></a>(constQPen&amp;p)const</div>
<li><div class="fn">bool<a href="#6248b8"><b>operator!=</b></a>(constQPen&amp;p)const</div>
</ul>
<h2>Related Functions</h2>
(Note that these are not member functions.)
<ul>
<li>QDataStream &amp; <a href="qpen.html#49435e"><b>operator&lt;&lt;</b></a> (QDataStream &amp; s, const QPen &amp; p)
<li>QDataStream &amp; <a href="qpen.html#e8d8ed"><b>operator&gt;&gt;</b></a> (QDataStream &amp; s, QPen &amp; p)
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QPen class defines how a <a href="qpainter.html">QPainter</a> should draw lines and outlines of shapes.
<p>
A pen has a style, a width, a color, a cap style and a join style.
<p>The pen style defines the line type. The default pen style is <code>Qt::SolidLine.</code> Setting the style to <code>NoPen</code> tells the painter to
not draw lines or outlines.
<p>The pen width defines the line width. The default line width is 0,
which draws a 1-pixel line very fast, but with lower precision than
with a line width of 1. Setting the line width to 1 or more draws
lines that are precise, but drawing is slower.
<p>The pen color defines the color of lines and text. The default line
color is black.  The <a href="qcolor.html">QColor</a> documentation lists predefined colors.
<p>The cap style defines how the end points of lines are drawn. The
join style defines how the joins between two lines drawn when
multiple, connected lines are drawn (QPainter::drawPolyLine() etc.).
The cap and join styles apply only to wide lines, i.e. when the
width is 1 or greater.
<p>Use the <a href="qbrush.html">QBrush</a> class for specifying fill styles.
<p>Example:
<pre>    <a href="qpainter.html">QPainter</a> painter;
    <a href="qpen.html">QPen</a>     pen( red, 2 );             // red solid line, 2 pixel width
    painter.<a href="qpainter.html#02ed5d">begin</a>( &amp;anyPaintDevice );   // paint something
    painter.<a href="qpainter.html#0183e4">setPen</a>( pen );              // set the red, fat pen
    painter.<a href="qpainter.html#4c0077">drawRect</a>( 40,30, 200,100 ); // draw rectangle
    painter.<a href="qpainter.html#0183e4">setPen</a>( blue );             // set blue pen, 0 pixel width
    painter.<a href="qpainter.html#e3a489">drawLine</a>( 40,30, 240,130 ); // draw diagonal in rectangle
    painter.<a href="qpainter.html#365784">end</a>();                      // painting done
</pre>
<p>See the <a href="#62894c">setStyle</a>() function for a complete list of pen styles.
<p>About the end point of lines: For wide (non-0-width) pens, it
depends on the cap style whether the end point is drawn or not. For
0-width pens, QPainter will try to make sure that the end point is
drawn, but this cannot be absolutely guaranteed, since the underlying
drawing engine is free to use any (typically accellerated) algorithm
for drawing 0-width lines. On all tested systems, however, the
endpoint of at least all non-diagonal lines are drawn.
<p>See also  <a href="qpainter.html">QPainter</a> and <a href="qpainter.html#0183e4">QPainter::setPen</a>().
<p>Examples:
 <a href="progress-progress-cpp.html#QPen">progress/progress.cpp</a>
 <a href="desktop-desktop-cpp.html#QPen">desktop/desktop.cpp</a>

<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="171192"></a>QPen::QPen()</h3>
<p>Constructs a default black solid line pen with 0 width.
<h3 class="fn"><a name="90cf48"></a>QPen::QPen(<a href="qt.html#PenStyle">PenStyle</a>style)</h3>
<p>Constructs a  pen black with 0 width and a specified style.
<p>See also  <a href="#62894c">setStyle</a>().
<h3 class="fn"><a name="679c79"></a>QPen::QPen(const<a href="qcolor.html">QColor</a>&amp;cl, uintw, <a href="qt.html#PenStyle">PenStyle</a>s, <a href="qt.html#PenCapStyle">PenCapStyle</a>c, <a href="qt.html#PenJoinStyle">PenJoinStyle</a>j)</h3>
<p>Constructs a pen with a specified color, width and styles.
<p>See also  <a href="#6a009f">setWidth</a>(), <a href="#62894c">setStyle</a>() and <a href="#00d674">setColor</a>().
<h3 class="fn"><a name="1e24bd"></a>QPen::QPen(const<a href="qcolor.html">QColor</a>&amp;color, uintwidth=0, <a href="qt.html#PenStyle">PenStyle</a>style=SolidLine)</h3>
<p>Constructs a pen with a specified color, width and style.
<p>See also  <a href="#6a009f">setWidth</a>(), <a href="#62894c">setStyle</a>() and <a href="#00d674">setColor</a>().
<h3 class="fn"><a name="b56f1c"></a>QPen::QPen(constQPen&amp;p)</h3>
<p>Constructs a pen which is a copy of <em>p.</em>
<h3 class="fn"><a name="2d9c9a"></a>QPen::~QPen()</h3>
<p>Destructs the pen.
<h3 class="fn">Qt::PenCapStyle<a name="0adb18"></a>QPen::capStyle()const</h3>
<p>Returns the pen's cap style.
<p>See also  <a href="#23e021">setCapStyle</a>().
<h3 class="fn">const<a href="qcolor.html">QColor</a>&amp;<a name="0db022"></a>QPen::color()const</h3>
<p>Returns the pen color.
<p>See also  <a href="#00d674">setColor</a>().
<h3 class="fn">Qt::PenJoinStyle<a name="0cc1c8"></a>QPen::joinStyle()const</h3>
<p>Returns the pen's join style.
<p>See also  <a href="#43cd4a">setJoinStyle</a>().
<h3 class="fn">bool<a name="6248b8"></a>QPen::operator!=(constQPen&amp;p)const</h3>
<p>Returns TRUE if the pen is different from <em>p,</em> or FALSE if the pens
are equal.
<p>Two pens are different if they have different styles, widths or colors.
<p>See also  <a href="#7a1a86">operator==</a>().
<h3 class="fn">QPen&amp;<a name="7ce458"></a>QPen::operator=(constQPen&amp;p)</h3>
<p>Assigns <em>c</em> to this pen and returns a reference to this pen.
<h3 class="fn">bool<a name="7a1a86"></a>QPen::operator==(constQPen&amp;p)const</h3>
<p>Returns TRUE if the pen is equal to <em>p,</em> or FALSE if the pens are
different.
<p>Two pens are equal if they have equal styles, widths and colors.
<p>See also  <a href="#6248b8">operator!=</a>().
<h3 class="fn">void<a name="23e021"></a>QPen::setCapStyle(<a href="qt.html#PenCapStyle">PenCapStyle</a>c)</h3>
<p>Sets the pen's cap style to <em>c.</em>
<p>The default value is FlatCap. The cap style has no effect on 0-width pens.<p><b>Warning:</b> On Windows 95/98, the cap style setting has no effect. Wide
lines are rendered as if the cap style was SquareCap.
<p>See also  <a href="#0adb18">capStyle</a>().
<h3 class="fn">void<a name="00d674"></a>QPen::setColor(const<a href="qcolor.html">QColor</a>&amp;c)</h3>
<p>Sets the pen color to <em>c.</em>
<p>See also  <a href="#0db022">color</a>().
<p>Examples:
 <a href="progress-progress-cpp.html#setColor">progress/progress.cpp</a>
<h3 class="fn">void<a name="43cd4a"></a>QPen::setJoinStyle(<a href="qt.html#PenJoinStyle">PenJoinStyle</a>j)</h3>
<p>Sets the pen's join style to <em>j.</em>
<p>The default value is MiterJoin. The join style has no effect on 0-width pens.<p><b>Warning:</b> On Windows 95/98, the join style setting has no effect. Wide
lines are rendered as if the join style was BevelJoin.
<p>See also  <a href="#0cc1c8">joinStyle</a>().
<h3 class="fn">void<a name="62894c"></a>QPen::setStyle(<a href="qt.html#PenStyle">PenStyle</a>s)</h3>
<p>Sets the pen style to <em>s.<p><b>Warning:</b></em> On Windows 95/98, the style setting (other than NoPen and
SolidLine) has no effect for lines with width greater than 1.
<p>See also  <a href="#e2fb15">style</a>().
<h3 class="fn">void<a name="6a009f"></a>QPen::setWidth(uintw)</h3>
<p>Sets the pen width to <em>w.</em>
<p>See also  <a href="#7bedc6">width</a>().
<p>Examples:
 <a href="progress-progress-cpp.html#setWidth">progress/progress.cpp</a>
<h3 class="fn"><a href="qt.html#PenStyle">PenStyle</a><a name="e2fb15"></a>QPen::style()const</h3>
<p>Returns the pen style.
<p>See also  <a href="#62894c">setStyle</a>().
<h3 class="fn">uint<a name="7bedc6"></a>QPen::width()const</h3>
<p>Returns the pen width.
<p>See also  <a href="#6a009f">setWidth</a>().
<hr><h2>Related Functions</h2>
<h3><a href="qdatastream.html">QDataStream</a> &amp; <a name="49435e"></a>operator&lt;&lt; (<a href="qdatastream.html">QDataStream</a> &amp; s, const QPen &amp; p)</h3>
<p>Writes a pen to the stream and returns a reference to the stream.
<p>See also  <a href="datastreamformat.html">Format of the QDataStream operators</a>

<h3><a href="qdatastream.html">QDataStream</a> &amp; <a name="e8d8ed"></a>operator&gt;&gt; (<a href="qdatastream.html">QDataStream</a> &amp; s, QPen &amp; p)</h3>
<p>Reads a pen from the stream and returns a reference to the stream.
<p>See also  <a href="datastreamformat.html">Format of the QDataStream operators</a>

<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright &copy; 1995-2001
<a href="http://www.trolltech.com">Trolltech</a>, all rights reserved.<p><address><hr><div align="center">
<table width="100%" cellspacing="0" border="0"><tr>
<td>Copyright  2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>