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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
|
'\" t
.TH QColorGroup 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
QColorGroup \- Group of widget colors
.SH SYNOPSIS
\fC#include <ntqpalette.h>\fR
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQColorGroup\fR ()"
.br
.ti -1c
.BI "QColorGroup ( const QColor & foreground, const QColor & background, const QColor & light, const QColor & dark, const QColor & mid, const QColor & text, const QColor & base ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "\fBQColorGroup\fR ( const QBrush & foreground, const QBrush & button, const QBrush & light, const QBrush & dark, const QBrush & mid, const QBrush & text, const QBrush & bright_text, const QBrush & base, const QBrush & background )"
.br
.ti -1c
.BI "\fBQColorGroup\fR ( const QColorGroup & other )"
.br
.ti -1c
.BI "\fB~QColorGroup\fR ()"
.br
.ti -1c
.BI "QColorGroup & \fBoperator=\fR ( const QColorGroup & other )"
.br
.ti -1c
.BI "enum \fBColorRole\fR { Foreground, Button, Light, Midlight, Dark, Mid, Text, BrightText, ButtonText, Base, Background, Shadow, Highlight, HighlightedText, Link, LinkVisited, NColorRoles }"
.br
.ti -1c
.BI "const QColor & \fBcolor\fR ( ColorRole r ) const"
.br
.ti -1c
.BI "const QBrush & \fBbrush\fR ( ColorRole r ) const"
.br
.ti -1c
.BI "void \fBsetColor\fR ( ColorRole r, const QColor & c )"
.br
.ti -1c
.BI "void \fBsetBrush\fR ( ColorRole r, const QBrush & b )"
.br
.ti -1c
.BI "const QColor & \fBforeground\fR () const"
.br
.ti -1c
.BI "const QColor & \fBbutton\fR () const"
.br
.ti -1c
.BI "const QColor & \fBlight\fR () const"
.br
.ti -1c
.BI "const QColor & \fBdark\fR () const"
.br
.ti -1c
.BI "const QColor & \fBmid\fR () const"
.br
.ti -1c
.BI "const QColor & \fBtext\fR () const"
.br
.ti -1c
.BI "const QColor & \fBbase\fR () const"
.br
.ti -1c
.BI "const QColor & \fBbackground\fR () const"
.br
.ti -1c
.BI "const QColor & \fBmidlight\fR () const"
.br
.ti -1c
.BI "const QColor & \fBbrightText\fR () const"
.br
.ti -1c
.BI "const QColor & \fBbuttonText\fR () const"
.br
.ti -1c
.BI "const QColor & \fBshadow\fR () const"
.br
.ti -1c
.BI "const QColor & \fBhighlight\fR () const"
.br
.ti -1c
.BI "const QColor & \fBhighlightedText\fR () const"
.br
.ti -1c
.BI "const QColor & \fBlink\fR () const"
.br
.ti -1c
.BI "const QColor & \fBlinkVisited\fR () const"
.br
.ti -1c
.BI "bool \fBoperator==\fR ( const QColorGroup & g ) const"
.br
.ti -1c
.BI "bool \fBoperator!=\fR ( const QColorGroup & g ) const"
.br
.in -1c
.SH RELATED FUNCTION DOCUMENTATION
.in +1c
.ti -1c
.BI "QDataStream & \fBoperator<<\fR ( QDataStream & s, const QColorGroup & g )"
.br
.in -1c
.SH DESCRIPTION
The QColorGroup class contains a group of widget colors.
.PP
A color group contains a group of colors used by widgets for drawing themselves. We recommend that widgets use color group roles such as "foreground" and "base" rather than literal colors like "red" or "turquoise". The color roles are enumerated and defined in the ColorRole documentation.
.PP
The most common use of QColorGroup is like this:
.PP
.nf
.br
QPainter p;
.br
...
.br
p.setPen( colorGroup().foreground() );
.br
p.drawLine( ... )
.br
.fi
.PP
It is also possible to modify color groups or create new color groups from scratch.
.PP
The color group class can be created using three different constructors or by modifying one supplied by Qt. The default constructor creates an all-black color group, which can then be modified using set functions; there's also a constructor for specifying all the color group colors. And there is also a copy constructor.
.PP
We strongly recommend using a system-supplied color group and modifying that as necessary.
.PP
You modify a color group by calling the access functions setColor() and setBrush(), depending on whether you want a pure color or a pixmap pattern.
.PP
There are also corresponding color() and brush() getters, and a commonly used convenience function to get each ColorRole: background(), foreground(), base(), etc.
.PP
See also QColor, QPalette, QWidget::colorGroup, Widget Appearance and Style, Graphics Classes, and Image Processing Classes.
.SS "Member Type Documentation"
.SH "QColorGroup::ColorRole"
The ColorRole enum defines the different symbolic color roles used in current GUIs.
.PP
The central roles are:
.TP
\fCQColorGroup::Background\fR - general background color.
.TP
\fCQColorGroup::Foreground\fR - general foreground color.
.TP
\fCQColorGroup::Base\fR - used as background color for text entry widgets, for example; usually white or another light color.
.TP
\fCQColorGroup::Text\fR - the foreground color used with Base. Usually this is the same as the Foreground, in which case it must provide good contrast with Background and Base.
.TP
\fCQColorGroup::Button\fR - general button background color in which buttons need a background different from Background, as in the Macintosh style.
.TP
\fCQColorGroup::ButtonText\fR - a foreground color used with the Button color.
.PP
There are some color roles used mostly for 3D bevel and shadow effects:
.TP
\fCQColorGroup::Light\fR - lighter than Button color.
.TP
\fCQColorGroup::Midlight\fR - between Button and Light.
.TP
\fCQColorGroup::Dark\fR - darker than Button.
.TP
\fCQColorGroup::Mid\fR - between Button and Dark.
.TP
\fCQColorGroup::Shadow\fR - a very dark color. By default, the shadow color is \fCQt::black\fR.
.PP
All of these are normally derived from Background and used in ways that depend on that relationship. For example, buttons depend on it to make the bevels look attractive, and Motif scroll bars depend on Mid to be slightly different from Background.
.PP
Selected (marked) items have two roles:
.TP
\fCQColorGroup::Highlight\fR - a color to indicate a selected item or the current item. By default, the highlight color is \fCQt::darkBlue\fR.
.TP
\fCQColorGroup::HighlightedText\fR - a text color that contrasts with Highlight. By default, the highlighted text color is \fCQt::white\fR.
.PP
Finally, there is a special role for text that needs to be drawn where Text or Foreground would give poor contrast, such as on pressed push buttons:
.TP
\fCQColorGroup::BrightText\fR - a text color that is very different from Foreground and contrasts well with e.g. Dark.
.TP
\fCQColorGroup::Link\fR - a text color used for unvisited hyperlinks. By default, the link color is \fCQt::blue\fR.
.TP
\fCQColorGroup::LinkVisited\fR - a text color used for already visited hyperlinks. By default, the linkvisited color is \fCQt::magenta\fR.
.TP
\fCQColorGroup::NColorRoles\fR - Internal.
.PP
Note that text colors can be used for things other than just words; text colors are \fIusually\fR used for text, but it's quite common to use the text color roles for lines, icons, etc.
.PP
This image shows most of the color roles in use: <center>
.ce 1
.B "[Image Omitted]"
.PP
</center>
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QColorGroup::QColorGroup ()"
Constructs a color group with all colors set to black.
.SH "QColorGroup::QColorGroup ( const QColor & foreground, const QColor & background, const QColor & light, const QColor & dark, const QColor & mid, const QColor & text, const QColor & base )"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Constructs a color group with the specified colors. The button color will be set to the background color.
.SH "QColorGroup::QColorGroup ( const QBrush & foreground, const QBrush & button, const QBrush & light, const QBrush & dark, const QBrush & mid, const QBrush & text, const QBrush & bright_text, const QBrush & base, const QBrush & background )"
Constructs a color group. You can pass either brushes, pixmaps or plain colors for \fIforeground\fR, \fIbutton\fR, \fIlight\fR, \fIdark\fR, \fImid\fR, \fItext\fR, \fIbright_text\fR, \fIbase\fR and \fIbackground\fR.
.PP
See also QBrush.
.SH "QColorGroup::QColorGroup ( const QColorGroup & other )"
Constructs a color group that is an independent copy of \fIother\fR.
.SH "QColorGroup::~QColorGroup ()"
Destroys the color group.
.SH "const QColor & QColorGroup::background () const"
Returns the background color of the color group.
.PP
See also ColorRole.
.SH "const QColor & QColorGroup::base () const"
Returns the base color of the color group.
.PP
See also ColorRole.
.SH "const QColor & QColorGroup::brightText () const"
Returns the bright text foreground color of the color group.
.PP
See also ColorRole.
.PP
Examples:
.)l themes/metal.cpp and themes/wood.cpp.
.SH "const QBrush & QColorGroup::brush ( ColorRole r ) const"
Returns the brush that has been set for color role \fIr\fR.
.PP
See also color(), setBrush(), and ColorRole.
.PP
Examples:
.)l themes/metal.cpp and themes/wood.cpp.
.SH "const QColor & QColorGroup::button () const"
Returns the button color of the color group.
.PP
See also ColorRole.
.PP
Examples:
.)l themes/metal.cpp and themes/wood.cpp.
.SH "const QColor & QColorGroup::buttonText () const"
Returns the button text foreground color of the color group.
.PP
See also ColorRole.
.PP
Examples:
.)l themes/metal.cpp and themes/wood.cpp.
.SH "const QColor & QColorGroup::color ( ColorRole r ) const"
Returns the color that has been set for color role \fIr\fR.
.PP
See also brush() and ColorRole.
.SH "const QColor & QColorGroup::dark () const"
Returns the dark color of the color group.
.PP
See also ColorRole.
.PP
Example: themes/wood.cpp.
.SH "const QColor & QColorGroup::foreground () const"
Returns the foreground color of the color group.
.PP
See also ColorRole.
.PP
Examples:
.)l themes/metal.cpp and themes/wood.cpp.
.SH "const QColor & QColorGroup::highlight () const"
Returns the highlight color of the color group.
.PP
See also ColorRole.
.SH "const QColor & QColorGroup::highlightedText () const"
Returns the highlighted text color of the color group.
.PP
See also ColorRole.
.SH "const QColor & QColorGroup::light () const"
Returns the light color of the color group.
.PP
See also ColorRole.
.PP
Example: themes/wood.cpp.
.SH "const QColor & QColorGroup::link () const"
Returns the unvisited link text color of the color group.
.PP
See also ColorRole.
.SH "const QColor & QColorGroup::linkVisited () const"
Returns the visited link text color of the color group.
.PP
See also ColorRole.
.SH "const QColor & QColorGroup::mid () const"
Returns the mid color of the color group.
.PP
See also ColorRole.
.PP
Examples:
.)l themes/metal.cpp and themes/wood.cpp.
.SH "const QColor & QColorGroup::midlight () const"
Returns the midlight color of the color group.
.PP
See also ColorRole.
.SH "bool QColorGroup::operator!= ( const QColorGroup & g ) const"
Returns TRUE if this color group is different from \fIg\fR; otherwise returns FALSE.
.PP
See also
.SH "QColorGroup & QColorGroup::operator= ( const QColorGroup & other )"
Copies the colors of \fIother\fR to this color group.
.SH "bool QColorGroup::operator== ( const QColorGroup & g ) const"
Returns TRUE if this color group is equal to \fIg\fR; otherwise returns FALSE.
.PP
See also
.SH "void QColorGroup::setBrush ( ColorRole r, const QBrush & b )"
Sets the brush used for color role \fIr\fR to \fIb\fR.
.PP
See also brush(), setColor(), and ColorRole.
.PP
Example: themes/wood.cpp.
.SH "void QColorGroup::setColor ( ColorRole r, const QColor & c )"
Sets the brush used for color role \fIr\fR to a solid color \fIc\fR.
.PP
See also brush() and ColorRole.
.PP
Examples:
.)l listviews/listviews.cpp, table/statistics/statistics.cpp, and themes/metal.cpp.
.SH "const QColor & QColorGroup::shadow () const"
Returns the shadow color of the color group.
.PP
See also ColorRole.
.SH "const QColor & QColorGroup::text () const"
Returns the text foreground color of the color group.
.PP
See also ColorRole.
.PP
Example: listviews/listviews.cpp.
.SH RELATED FUNCTION DOCUMENTATION
.SH "QDataStream & operator<< ( QDataStream & s, const QColorGroup & g )"
Writes color group, \fIg\fR to the stream \fIs\fR.
.PP
See also Format of the QDataStream operators.
.SH "SEE ALSO"
.BR http://doc.trolltech.com/qcolorgroup.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 (qcolorgroup.3qt) and the Qt
version (3.3.8).
|