1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qpainter.cpp:3567 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QBrush Class</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QBrush Class Reference</h1>
|
---|
33 |
|
---|
34 | <p>The QBrush class defines the fill pattern of shapes drawn by a QPainter.
|
---|
35 | <a href="#details">More...</a>
|
---|
36 | <p><tt>#include <<a href="qbrush-h.html">qbrush.h</a>></tt>
|
---|
37 | <p>Inherits <a href="qt.html">Qt</a>.
|
---|
38 | <p><a href="qbrush-members.html">List of all member functions.</a>
|
---|
39 | <h2>Public Members</h2>
|
---|
40 | <ul>
|
---|
41 | <li class=fn><a href="#QBrush"><b>QBrush</b></a> ()</li>
|
---|
42 | <li class=fn><a href="#QBrush-2"><b>QBrush</b></a> ( BrushStyle style )</li>
|
---|
43 | <li class=fn><a href="#QBrush-3"><b>QBrush</b></a> ( const QColor & color, BrushStyle style = SolidPattern )</li>
|
---|
44 | <li class=fn><a href="#QBrush-4"><b>QBrush</b></a> ( const QColor & color, const QPixmap & pixmap )</li>
|
---|
45 | <li class=fn><a href="#QBrush-5"><b>QBrush</b></a> ( const QBrush & b )</li>
|
---|
46 | <li class=fn><a href="#~QBrush"><b>~QBrush</b></a> ()</li>
|
---|
47 | <li class=fn>QBrush & <a href="#operator-eq"><b>operator=</b></a> ( const QBrush & b )</li>
|
---|
48 | <li class=fn>BrushStyle <a href="#style"><b>style</b></a> () const</li>
|
---|
49 | <li class=fn>void <a href="#setStyle"><b>setStyle</b></a> ( BrushStyle s )</li>
|
---|
50 | <li class=fn>const QColor & <a href="#color"><b>color</b></a> () const</li>
|
---|
51 | <li class=fn>void <a href="#setColor"><b>setColor</b></a> ( const QColor & c )</li>
|
---|
52 | <li class=fn>QPixmap * <a href="#pixmap"><b>pixmap</b></a> () const</li>
|
---|
53 | <li class=fn>void <a href="#setPixmap"><b>setPixmap</b></a> ( const QPixmap & pixmap )</li>
|
---|
54 | <li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const QBrush & b ) const</li>
|
---|
55 | <li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const QBrush & b ) const</li>
|
---|
56 | </ul>
|
---|
57 | <h2>Related Functions</h2>
|
---|
58 | <ul>
|
---|
59 | <li class=fn>QDataStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( QDataStream & s, const QBrush & b )</li>
|
---|
60 | <li class=fn>QDataStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( QDataStream & s, QBrush & b )</li>
|
---|
61 | </ul>
|
---|
62 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
63 |
|
---|
64 |
|
---|
65 | <p> The QBrush class defines the fill pattern of shapes drawn by a <a href="qpainter.html">QPainter</a>.
|
---|
66 | <p>
|
---|
67 |
|
---|
68 |
|
---|
69 | <p> A brush has a style and a color. One of the brush styles is a
|
---|
70 | custom pattern, which is defined by a <a href="qpixmap.html">QPixmap</a>.
|
---|
71 | <p> The brush style defines the fill pattern. The default brush style
|
---|
72 | is <a href="qt.html#BrushStyle-enum">NoBrush</a> (depending on how you construct a brush). This style
|
---|
73 | tells the painter to not fill shapes. The standard style for
|
---|
74 | filling is <a href="qt.html#BrushStyle-enum">SolidPattern</a>.
|
---|
75 | <p> The brush color defines the color of the fill pattern. The <a href="qcolor.html">QColor</a>
|
---|
76 | documentation lists the predefined colors.
|
---|
77 | <p> Use the <a href="qpen.html">QPen</a> class for specifying line/outline styles.
|
---|
78 | <p> Example:
|
---|
79 | <pre>
|
---|
80 | <a href="qpainter.html">QPainter</a> painter;
|
---|
81 | QBrush brush( yellow ); // yellow solid pattern
|
---|
82 | painter.<a href="qpainter.html#begin">begin</a>( &anyPaintDevice ); // paint something
|
---|
83 | painter.<a href="qpainter.html#setBrush">setBrush</a>( brush ); // set the yellow brush
|
---|
84 | painter.<a href="qpainter.html#setPen">setPen</a>( <a href="qt.html#PenStyle-enum">NoPen</a> ); // do not draw outline
|
---|
85 | painter.<a href="qpainter.html#drawRect">drawRect</a>( 40,30, 200,100 ); // draw filled rectangle
|
---|
86 | painter.<a href="qpainter.html#setBrush">setBrush</a>( <a href="qt.html#BrushStyle-enum">NoBrush</a> ); // do not fill
|
---|
87 | painter.<a href="qpainter.html#setPen">setPen</a>( black ); // set black pen, 0 pixel width
|
---|
88 | painter.<a href="qpainter.html#drawRect">drawRect</a>( 10,10, 30,20 ); // draw rectangle outline
|
---|
89 | painter.<a href="qpainter.html#end">end</a>(); // painting done
|
---|
90 | </pre>
|
---|
91 |
|
---|
92 | <p> See the <a href="#setStyle">setStyle</a>() function for a complete list of brush styles.
|
---|
93 | <p> <center><img src="brush-styles.png" alt="Brush Styles"></center>
|
---|
94 | <p> <p>See also <a href="qpainter.html">QPainter</a>, <a href="qpainter.html#setBrush">QPainter::setBrush</a>(), <a href="qpainter.html#setBrushOrigin">QPainter::setBrushOrigin</a>(), <a href="graphics.html">Graphics Classes</a>, <a href="images.html">Image Processing Classes</a>, and <a href="shared.html">Implicitly and Explicitly Shared Classes</a>.
|
---|
95 |
|
---|
96 | <hr><h2>Member Function Documentation</h2>
|
---|
97 | <h3 class=fn><a name="QBrush"></a>QBrush::QBrush ()
|
---|
98 | </h3>
|
---|
99 | Constructs a default black brush with the style <a href="qt.html#BrushStyle-enum">NoBrush</a> (will
|
---|
100 | not fill shapes).
|
---|
101 |
|
---|
102 | <h3 class=fn><a name="QBrush-2"></a>QBrush::QBrush ( <a href="qt.html#BrushStyle-enum">BrushStyle</a> style )
|
---|
103 | </h3>
|
---|
104 | Constructs a black brush with the style <em>style</em>.
|
---|
105 | <p> <p>See also <a href="#setStyle">setStyle</a>().
|
---|
106 |
|
---|
107 | <h3 class=fn><a name="QBrush-3"></a>QBrush::QBrush ( const <a href="qcolor.html">QColor</a> & color, <a href="qt.html#BrushStyle-enum">BrushStyle</a> style = SolidPattern )
|
---|
108 | </h3>
|
---|
109 | Constructs a brush with the color <em>color</em> and the style <em>style</em>.
|
---|
110 | <p> <p>See also <a href="#setColor">setColor</a>() and <a href="#setStyle">setStyle</a>().
|
---|
111 |
|
---|
112 | <h3 class=fn><a name="QBrush-4"></a>QBrush::QBrush ( const <a href="qcolor.html">QColor</a> & color, const <a href="qpixmap.html">QPixmap</a> & pixmap )
|
---|
113 | </h3>
|
---|
114 | Constructs a brush with the color <em>color</em> and a custom pattern
|
---|
115 | stored in <em>pixmap</em>.
|
---|
116 | <p> The color will only have an effect for monochrome pixmaps, i.e.
|
---|
117 | for <a href="qpixmap.html#depth">QPixmap::depth</a>() == 1.
|
---|
118 | <p> Pixmap brushes are currently not supported when printing on X11.
|
---|
119 | <p> <p>See also <a href="#setColor">setColor</a>() and <a href="#setPixmap">setPixmap</a>().
|
---|
120 |
|
---|
121 | <h3 class=fn><a name="QBrush-5"></a>QBrush::QBrush ( const <a href="qbrush.html">QBrush</a> & b )
|
---|
122 | </h3>
|
---|
123 | Constructs a brush that is a <a href="shclass.html">shallow
|
---|
124 | copy</a> of <em>b</em>.
|
---|
125 |
|
---|
126 | <h3 class=fn><a name="~QBrush"></a>QBrush::~QBrush ()
|
---|
127 | </h3>
|
---|
128 | Destroys the brush.
|
---|
129 |
|
---|
130 | <h3 class=fn>const <a href="qcolor.html">QColor</a> & <a name="color"></a>QBrush::color () const
|
---|
131 | </h3>
|
---|
132 |
|
---|
133 | <p> Returns the brush color.
|
---|
134 | <p> <p>See also <a href="#setColor">setColor</a>().
|
---|
135 |
|
---|
136 | <h3 class=fn>bool <a name="operator!-eq"></a>QBrush::operator!= ( const <a href="qbrush.html">QBrush</a> & b ) const
|
---|
137 | </h3>
|
---|
138 |
|
---|
139 | <p> Returns TRUE if the brush is different from <em>b</em>; otherwise
|
---|
140 | returns FALSE.
|
---|
141 | <p> Two brushes are different if they have different styles, colors or
|
---|
142 | pixmaps.
|
---|
143 | <p> <p>See also <a href="#operator-eq-eq">operator==</a>().
|
---|
144 |
|
---|
145 | <h3 class=fn><a href="qbrush.html">QBrush</a> & <a name="operator-eq"></a>QBrush::operator= ( const <a href="qbrush.html">QBrush</a> & b )
|
---|
146 | </h3>
|
---|
147 | Assigns <em>b</em> to this brush and returns a reference to this brush.
|
---|
148 |
|
---|
149 | <h3 class=fn>bool <a name="operator-eq-eq"></a>QBrush::operator== ( const <a href="qbrush.html">QBrush</a> & b ) const
|
---|
150 | </h3>
|
---|
151 | Returns TRUE if the brush is equal to <em>b</em>; otherwise returns
|
---|
152 | FALSE.
|
---|
153 | <p> Two brushes are equal if they have equal styles, colors and
|
---|
154 | pixmaps.
|
---|
155 | <p> <p>See also <a href="#operator!-eq">operator!=</a>().
|
---|
156 |
|
---|
157 | <h3 class=fn><a href="qpixmap.html">QPixmap</a> * <a name="pixmap"></a>QBrush::pixmap () const
|
---|
158 | </h3>
|
---|
159 |
|
---|
160 | <p> Returns a pointer to the custom brush pattern, or 0 if no custom
|
---|
161 | brush pattern has been set.
|
---|
162 | <p> <p>See also <a href="#setPixmap">setPixmap</a>().
|
---|
163 |
|
---|
164 | <p>Example: <a href="richtext-example.html#x460">richtext/richtext.cpp</a>.
|
---|
165 | <h3 class=fn>void <a name="setColor"></a>QBrush::setColor ( const <a href="qcolor.html">QColor</a> & c )
|
---|
166 | </h3>
|
---|
167 | Sets the brush color to <em>c</em>.
|
---|
168 | <p> <p>See also <a href="#color">color</a>() and <a href="#setStyle">setStyle</a>().
|
---|
169 |
|
---|
170 | <p>Example: <a href="picture-example.html#x108">picture/picture.cpp</a>.
|
---|
171 | <h3 class=fn>void <a name="setPixmap"></a>QBrush::setPixmap ( const <a href="qpixmap.html">QPixmap</a> & pixmap )
|
---|
172 | </h3>
|
---|
173 | Sets the brush pixmap to <em>pixmap</em>. The style is set to <a href="qt.html#BrushStyle-enum">CustomPattern</a>.
|
---|
174 | <p> The current brush color will only have an effect for monochrome
|
---|
175 | pixmaps, i.e. for <a href="qpixmap.html#depth">QPixmap::depth</a>() == 1.
|
---|
176 | <p> Pixmap brushes are currently not supported when printing on X11.
|
---|
177 | <p> <p>See also <a href="#pixmap">pixmap</a>() and <a href="#color">color</a>().
|
---|
178 |
|
---|
179 | <p>Example: <a href="richtext-example.html#x461">richtext/richtext.cpp</a>.
|
---|
180 | <h3 class=fn>void <a name="setStyle"></a>QBrush::setStyle ( <a href="qt.html#BrushStyle-enum">BrushStyle</a> s )
|
---|
181 | </h3>
|
---|
182 | Sets the brush style to <em>s</em>.
|
---|
183 | <p> The brush styles are:
|
---|
184 | <center><table cellpadding="4" cellspacing="2" border="0">
|
---|
185 | <tr bgcolor="#a2c511"> <th valign="top">Pattern <th valign="top">Meaning
|
---|
186 | <tr bgcolor="#f0f0f0"> <td valign="top">NoBrush <td valign="top">will not fill shapes (default).
|
---|
187 | <tr bgcolor="#d0d0d0"> <td valign="top">SolidPattern <td valign="top">solid (100%) fill pattern.
|
---|
188 | <tr bgcolor="#f0f0f0"> <td valign="top">Dense1Pattern <td valign="top" colspan="1" rowspan="1"> 94% fill pattern.
|
---|
189 | <tr bgcolor="#d0d0d0"> <td valign="top">Dense2Pattern <td valign="top" colspan="1" rowspan="1"> 88% fill pattern.
|
---|
190 | <tr bgcolor="#f0f0f0"> <td valign="top">Dense3Pattern <td valign="top" colspan="1" rowspan="1"> 63% fill pattern.
|
---|
191 | <tr bgcolor="#d0d0d0"> <td valign="top">Dense4Pattern <td valign="top" colspan="1" rowspan="1"> 50% fill pattern.
|
---|
192 | <tr bgcolor="#f0f0f0"> <td valign="top">Dense5Pattern <td valign="top" colspan="1" rowspan="1"> 37% fill pattern.
|
---|
193 | <tr bgcolor="#d0d0d0"> <td valign="top">Dense6Pattern <td valign="top" colspan="1" rowspan="1"> 12% fill pattern.
|
---|
194 | <tr bgcolor="#f0f0f0"> <td valign="top">Dense7Pattern <td valign="top" colspan="1" rowspan="1"> 6% fill pattern.
|
---|
195 | <tr bgcolor="#d0d0d0"> <td valign="top">HorPattern <td valign="top">horizontal lines pattern.
|
---|
196 | <tr bgcolor="#f0f0f0"> <td valign="top">VerPattern <td valign="top">vertical lines pattern.
|
---|
197 | <tr bgcolor="#d0d0d0"> <td valign="top">CrossPattern <td valign="top">crossing lines pattern.
|
---|
198 | <tr bgcolor="#f0f0f0"> <td valign="top">BDiagPattern <td valign="top">diagonal lines (directed /) pattern.
|
---|
199 | <tr bgcolor="#d0d0d0"> <td valign="top">FDiagPattern <td valign="top">diagonal lines (directed \) pattern.
|
---|
200 | <tr bgcolor="#f0f0f0"> <td valign="top">DiagCrossPattern <td valign="top">diagonal crossing lines pattern.
|
---|
201 | <tr bgcolor="#d0d0d0"> <td valign="top">CustomPattern <td valign="top">set when a pixmap pattern is being used.
|
---|
202 | </table></center>
|
---|
203 | <p> On Windows, dense and custom patterns cannot be transparent.
|
---|
204 | <p> See the <a href="#details">Detailed Description</a> for a picture
|
---|
205 | of all the styles.
|
---|
206 | <p> <p>See also <a href="#style">style</a>().
|
---|
207 |
|
---|
208 | <h3 class=fn><a href="qt.html#BrushStyle-enum">BrushStyle</a> <a name="style"></a>QBrush::style () const
|
---|
209 | </h3>
|
---|
210 |
|
---|
211 | <p> Returns the brush style.
|
---|
212 | <p> <p>See also <a href="#setStyle">setStyle</a>().
|
---|
213 |
|
---|
214 | <hr><h2>Related Functions</h2>
|
---|
215 | <h3 class=fn><a href="qdatastream.html">QDataStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="qdatastream.html">QDataStream</a> & s, const <a href="qbrush.html">QBrush</a> & b )
|
---|
216 | </h3>
|
---|
217 |
|
---|
218 | <p> Writes the brush <em>b</em> to the stream <em>s</em> and returns a reference
|
---|
219 | to the stream.
|
---|
220 | <p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.
|
---|
221 |
|
---|
222 | <h3 class=fn><a href="qdatastream.html">QDataStream</a> & <a name="operator-gt-gt"></a>operator>> ( <a href="qdatastream.html">QDataStream</a> & s, <a href="qbrush.html">QBrush</a> & b )
|
---|
223 | </h3>
|
---|
224 |
|
---|
225 | <p> Reads the brush <em>b</em> from the stream <em>s</em> and returns a reference
|
---|
226 | to the stream.
|
---|
227 | <p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.
|
---|
228 |
|
---|
229 | <!-- eof -->
|
---|
230 | <hr><p>
|
---|
231 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
232 | Copyright © 1995-2007
|
---|
233 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
234 | <table width=100% cellspacing=0 border=0><tr>
|
---|
235 | <td>Copyright © 2007
|
---|
236 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
237 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
238 | </table></div></address></body>
|
---|
239 | </html>
|
---|