summaryrefslogtreecommitdiffstats
path: root/doc/man/man3/qbrush.3qt
blob: 0f32c72043f5ffb91cb09002fde905029588fd45 (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
'\" t
.TH QBrush 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
QBrush \- Defines the fill pattern of shapes drawn by a QPainter
.SH SYNOPSIS
\fC#include <ntqbrush.h>\fR
.PP
Inherits Qt.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQBrush\fR ()"
.br
.ti -1c
.BI "\fBQBrush\fR ( BrushStyle style )"
.br
.ti -1c
.BI "\fBQBrush\fR ( const QColor & color, BrushStyle style = SolidPattern )"
.br
.ti -1c
.BI "\fBQBrush\fR ( const QColor & color, const QPixmap & pixmap )"
.br
.ti -1c
.BI "\fBQBrush\fR ( const QBrush & b )"
.br
.ti -1c
.BI "\fB~QBrush\fR ()"
.br
.ti -1c
.BI "QBrush & \fBoperator=\fR ( const QBrush & b )"
.br
.ti -1c
.BI "BrushStyle \fBstyle\fR () const"
.br
.ti -1c
.BI "void \fBsetStyle\fR ( BrushStyle s )"
.br
.ti -1c
.BI "const QColor & \fBcolor\fR () const"
.br
.ti -1c
.BI "void \fBsetColor\fR ( const QColor & c )"
.br
.ti -1c
.BI "QPixmap * \fBpixmap\fR () const"
.br
.ti -1c
.BI "void \fBsetPixmap\fR ( const QPixmap & pixmap )"
.br
.ti -1c
.BI "bool \fBoperator==\fR ( const QBrush & b ) const"
.br
.ti -1c
.BI "bool \fBoperator!=\fR ( const QBrush & b ) const"
.br
.in -1c
.SH RELATED FUNCTION DOCUMENTATION
.in +1c
.ti -1c
.BI "QDataStream & \fBoperator<<\fR ( QDataStream & s, const QBrush & b )"
.br
.ti -1c
.BI "QDataStream & \fBoperator>>\fR ( QDataStream & s, QBrush & b )"
.br
.in -1c
.SH DESCRIPTION
The QBrush class defines the fill pattern of shapes drawn by a QPainter.
.PP
A brush has a style and a color. One of the brush styles is a custom pattern, which is defined by a QPixmap.
.PP
The brush style defines the fill pattern. The default brush style is NoBrush (depending on how you construct a brush). This style tells the painter to not fill shapes. The standard style for filling is SolidPattern.
.PP
The brush color defines the color of the fill pattern. The QColor documentation lists the predefined colors.
.PP
Use the QPen class for specifying line/outline styles.
.PP
Example:
.PP
.nf
.br
        QPainter painter;
.br
        QBrush   brush( yellow );           // yellow solid pattern
.br
        painter.begin( &anyPaintDevice );   // paint something
.br
        painter.setBrush( brush );          // set the yellow brush
.br
        painter.setPen( NoPen );            // do not draw outline
.br
        painter.drawRect( 40,30, 200,100 ); // draw filled rectangle
.br
        painter.setBrush( NoBrush );        // do not fill
.br
        painter.setPen( black );            // set black pen, 0 pixel width
.br
        painter.drawRect( 10,10, 30,20 );   // draw rectangle outline
.br
        painter.end();                      // painting done
.br
.fi
.PP
See the setStyle() function for a complete list of brush styles.
.PP
<center>
.ce 1
.B "[Image Omitted]"
.PP
</center>
.PP
See also QPainter, QPainter::setBrush(), QPainter::setBrushOrigin(), Graphics Classes, Image Processing Classes, and Implicitly and Explicitly Shared Classes.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QBrush::QBrush ()"
Constructs a default black brush with the style NoBrush (will not fill shapes).
.SH "QBrush::QBrush ( BrushStyle style )"
Constructs a black brush with the style \fIstyle\fR.
.PP
See also setStyle().
.SH "QBrush::QBrush ( const QColor & color, BrushStyle style = SolidPattern )"
Constructs a brush with the color \fIcolor\fR and the style \fIstyle\fR.
.PP
See also setColor() and setStyle().
.SH "QBrush::QBrush ( const QColor & color, const QPixmap & pixmap )"
Constructs a brush with the color \fIcolor\fR and a custom pattern stored in \fIpixmap\fR.
.PP
The color will only have an effect for monochrome pixmaps, i.e. for QPixmap::depth() == 1.
.PP
Pixmap brushes are currently not supported when printing on X11.
.PP
See also setColor() and setPixmap().
.SH "QBrush::QBrush ( const QBrush & b )"
Constructs a brush that is a shallow copy of \fIb\fR.
.SH "QBrush::~QBrush ()"
Destroys the brush.
.SH "const QColor & QBrush::color () const"
Returns the brush color.
.PP
See also setColor().
.SH "bool QBrush::operator!= ( const QBrush & b ) const"
Returns TRUE if the brush is different from \fIb\fR; otherwise returns FALSE.
.PP
Two brushes are different if they have different styles, colors or pixmaps.
.PP
See also operator==().
.SH "QBrush & QBrush::operator= ( const QBrush & b )"
Assigns \fIb\fR to this brush and returns a reference to this brush.
.SH "bool QBrush::operator== ( const QBrush & b ) const"
Returns TRUE if the brush is equal to \fIb\fR; otherwise returns FALSE.
.PP
Two brushes are equal if they have equal styles, colors and pixmaps.
.PP
See also operator!=().
.SH "QPixmap * QBrush::pixmap () const"
Returns a pointer to the custom brush pattern, or 0 if no custom brush pattern has been set.
.PP
See also setPixmap().
.PP
Example: richtext/richtext.cpp.
.SH "void QBrush::setColor ( const QColor & c )"
Sets the brush color to \fIc\fR.
.PP
See also color() and setStyle().
.PP
Example: picture/picture.cpp.
.SH "void QBrush::setPixmap ( const QPixmap & pixmap )"
Sets the brush pixmap to \fIpixmap\fR. The style is set to CustomPattern.
.PP
The current brush color will only have an effect for monochrome pixmaps, i.e. for QPixmap::depth() == 1.
.PP
Pixmap brushes are currently not supported when printing on X11.
.PP
See also pixmap() and color().
.PP
Example: richtext/richtext.cpp.
.SH "void QBrush::setStyle ( BrushStyle s )"
Sets the brush style to \fIs\fR.
.PP
The brush styles are: <center>.nf
.TS
l - l. Pattern Meaning NoBrush will not fill shapes (default). SolidPattern solid (100%) fill pattern. Dense1Pattern 94% fill pattern. Dense2Pattern 88% fill pattern. Dense3Pattern 63% fill pattern. Dense4Pattern 50% fill pattern. Dense5Pattern 37% fill pattern. Dense6Pattern 12% fill pattern. Dense7Pattern 6% fill pattern. HorPattern horizontal lines pattern. VerPattern vertical lines pattern. CrossPattern crossing lines pattern. BDiagPattern diagonal lines (directed /) pattern. FDiagPattern diagonal lines (directed &#92;) pattern. DiagCrossPattern diagonal crossing lines pattern. CustomPattern
.TE
.fi
</center>
.PP
On Windows, dense and custom patterns cannot be transparent.
.PP
See the Detailed Description for a picture of all the styles.
.PP
See also style().
.SH "BrushStyle QBrush::style () const"
Returns the brush style.
.PP
See also setStyle().
.SH RELATED FUNCTION DOCUMENTATION
.SH "QDataStream & operator<< ( QDataStream & s, const QBrush & b )"
Writes the brush \fIb\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, QBrush & b )"
Reads the brush \fIb\fR from the stream \fIs\fR and returns a reference to the stream.
.PP
See also Format of the QDataStream operators.

.SH "SEE ALSO"
.BR http://doc.trolltech.com/ntqbrush.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 Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt 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 [email protected] .
Please include the name of the manual page (qbrush.3qt) and the Qt
version (3.3.8).