1QBrush(3qt) QBrush(3qt)
2
3
4
6 QBrush - Defines the fill pattern of shapes drawn by a QPainter
7
9 #include <qbrush.h>
10
11 Inherits Qt.
12
13 Public Members
14 QBrush ()
15 QBrush ( BrushStyle style )
16 QBrush ( const QColor & color, BrushStyle style = SolidPattern )
17 QBrush ( const QColor & color, const QPixmap & pixmap )
18 QBrush ( const QBrush & b )
19 ~QBrush ()
20 QBrush & operator= ( const QBrush & b )
21 BrushStyle style () const
22 void setStyle ( BrushStyle s )
23 const QColor & color () const
24 void setColor ( const QColor & c )
25 QPixmap * pixmap () const
26 void setPixmap ( const QPixmap & pixmap )
27 bool operator== ( const QBrush & b ) const
28 bool operator!= ( const QBrush & b ) const
29
31 QDataStream & operator<< ( QDataStream & s, const QBrush & b )
32 QDataStream & operator>> ( QDataStream & s, QBrush & b )
33
35 The QBrush class defines the fill pattern of shapes drawn by a
36 QPainter.
37
38 A brush has a style and a color. One of the brush styles is a custom
39 pattern, which is defined by a QPixmap.
40
41 The brush style defines the fill pattern. The default brush style is
42 NoBrush (depending on how you construct a brush). This style tells the
43 painter to not fill shapes. The standard style for filling is
44 SolidPattern.
45
46 The brush color defines the color of the fill pattern. The QColor
47 documentation lists the predefined colors.
48
49 Use the QPen class for specifying line/outline styles.
50
51 Example:
52
53 QPainter painter;
54 QBrush brush( yellow ); // yellow solid pattern
55 painter.begin( &anyPaintDevice ); // paint something
56 painter.setBrush( brush ); // set the yellow brush
57 painter.setPen( NoPen ); // do not draw outline
58 painter.drawRect( 40,30, 200,100 ); // draw filled rectangle
59 painter.setBrush( NoBrush ); // do not fill
60 painter.setPen( black ); // set black pen, 0 pixel width
61 painter.drawRect( 10,10, 30,20 ); // draw rectangle outline
62 painter.end(); // painting done
63
64 See the setStyle() function for a complete list of brush styles.
65
66 <center>
67 [Image Omitted]
68
69 </center>
70
71 See also QPainter, QPainter::setBrush(), QPainter::setBrushOrigin(),
72 Graphics Classes, Image Processing Classes, and Implicitly and
73 Explicitly Shared Classes.
74
77 Constructs a default black brush with the style NoBrush (will not fill
78 shapes).
79
81 Constructs a black brush with the style style.
82
83 See also setStyle().
84
86 Constructs a brush with the color color and the style style.
87
88 See also setColor() and setStyle().
89
91 Constructs a brush with the color color and a custom pattern stored in
92 pixmap.
93
94 The color will only have an effect for monochrome pixmaps, i.e. for
95 QPixmap::depth() == 1.
96
97 Pixmap brushes are currently not supported when printing on X11.
98
99 See also setColor() and setPixmap().
100
102 Constructs a brush that is a shallow copy of b.
103
105 Destroys the brush.
106
108 Returns the brush color.
109
110 See also setColor().
111
113 Returns TRUE if the brush is different from b; otherwise returns FALSE.
114
115 Two brushes are different if they have different styles, colors or
116 pixmaps.
117
118 See also operator==().
119
121 Assigns b to this brush and returns a reference to this brush.
122
124 Returns TRUE if the brush is equal to b; otherwise returns FALSE.
125
126 Two brushes are equal if they have equal styles, colors and pixmaps.
127
128 See also operator!=().
129
131 Returns a pointer to the custom brush pattern, or 0 if no custom brush
132 pattern has been set.
133
134 See also setPixmap().
135
136 Example: richtext/richtext.cpp.
137
139 Sets the brush color to c.
140
141 See also color() and setStyle().
142
143 Example: picture/picture.cpp.
144
146 Sets the brush pixmap to pixmap. The style is set to CustomPattern.
147
148 The current brush color will only have an effect for monochrome
149 pixmaps, i.e. for QPixmap::depth() == 1.
150
151 Pixmap brushes are currently not supported when printing on X11.
152
153 See also pixmap() and color().
154
155 Example: richtext/richtext.cpp.
156
158 Sets the brush style to s.
159
160 The brush styles are: <center>.nf
161
162 </center>
163
164 On Windows, dense and custom patterns cannot be transparent.
165
166 See the Detailed Description for a picture of all the styles.
167
168 See also style().
169
171 Returns the brush style.
172
173 See also setStyle().
174
177 Writes the brush b to the stream s and returns a reference to the
178 stream.
179
180 See also Format of the QDataStream operators.
181
183 Reads the brush b from the stream s and returns a reference to the
184 stream.
185
186 See also Format of the QDataStream operators.
187
188
190 http://doc.trolltech.com/qbrush.html
191 http://www.trolltech.com/faq/tech.html
192
194 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
195 license file included in the distribution for a complete license
196 statement.
197
199 Generated automatically from the source code.
200
202 If you find a bug in Qt, please report it as described in
203 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
204 help you. Thank you.
205
206 The definitive Qt documentation is provided in HTML format; it is
207 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
208 web browser. This man page is provided as a convenience for those users
209 who prefer man pages, although this format is not officially supported
210 by Trolltech.
211
212 If you find errors in this manual page, please report them to qt-
213 bugs@trolltech.com. Please include the name of the manual page
214 (qbrush.3qt) and the Qt version (3.3.8).
215
216
217
218Trolltech AS 2 February 2007 QBrush(3qt)