1QColorGroup(3qt) QColorGroup(3qt)
2
3
4
6 QColorGroup - Group of widget colors
7
9 #include <qpalette.h>
10
11 Public Members
12 QColorGroup ()
13 QColorGroup ( const QColor & foreground, const QColor & background,
14 const QColor & light, const QColor & dark, const QColor & mid,
15 const QColor & text, const QColor & base ) (obsolete)
16 QColorGroup ( const QBrush & foreground, const QBrush & button, const
17 QBrush & light, const QBrush & dark, const QBrush & mid, const
18 QBrush & text, const QBrush & bright_text, const QBrush & base,
19 const QBrush & background )
20 QColorGroup ( const QColorGroup & other )
21 ~QColorGroup ()
22 QColorGroup & operator= ( const QColorGroup & other )
23 enum ColorRole { Foreground, Button, Light, Midlight, Dark, Mid, Text,
24 BrightText, ButtonText, Base, Background, Shadow, Highlight,
25 HighlightedText, Link, LinkVisited, NColorRoles }
26 const QColor & color ( ColorRole r ) const
27 const QBrush & brush ( ColorRole r ) const
28 void setColor ( ColorRole r, const QColor & c )
29 void setBrush ( ColorRole r, const QBrush & b )
30 const QColor & foreground () const
31 const QColor & button () const
32 const QColor & light () const
33 const QColor & dark () const
34 const QColor & mid () const
35 const QColor & text () const
36 const QColor & base () const
37 const QColor & background () const
38 const QColor & midlight () const
39 const QColor & brightText () const
40 const QColor & buttonText () const
41 const QColor & shadow () const
42 const QColor & highlight () const
43 const QColor & highlightedText () const
44 const QColor & link () const
45 const QColor & linkVisited () const
46 bool operator== ( const QColorGroup & g ) const
47 bool operator!= ( const QColorGroup & g ) const
48
50 QDataStream & operator<< ( QDataStream & s, const QColorGroup & g )
51
53 The QColorGroup class contains a group of widget colors.
54
55 A color group contains a group of colors used by widgets for drawing
56 themselves. We recommend that widgets use color group roles such as
57 "foreground" and "base" rather than literal colors like "red" or
58 "turquoise". The color roles are enumerated and defined in the
59 ColorRole documentation.
60
61 The most common use of QColorGroup is like this:
62
63 QPainter p;
64 ...
65 p.setPen( colorGroup().foreground() );
66 p.drawLine( ... )
67
68 It is also possible to modify color groups or create new color groups
69 from scratch.
70
71 The color group class can be created using three different constructors
72 or by modifying one supplied by Qt. The default constructor creates an
73 all-black color group, which can then be modified using set functions;
74 there's also a constructor for specifying all the color group colors.
75 And there is also a copy constructor.
76
77 We strongly recommend using a system-supplied color group and modifying
78 that as necessary.
79
80 You modify a color group by calling the access functions setColor() and
81 setBrush(), depending on whether you want a pure color or a pixmap
82 pattern.
83
84 There are also corresponding color() and brush() getters, and a
85 commonly used convenience function to get each ColorRole: background(),
86 foreground(), base(), etc.
87
88 See also QColor, QPalette, QWidget::colorGroup, Widget Appearance and
89 Style, Graphics Classes, and Image Processing Classes.
90
91 Member Type Documentation
93 The ColorRole enum defines the different symbolic color roles used in
94 current GUIs.
95
96 The central roles are:
97
98 QColorGroup::Background - general background color.
99
100 QColorGroup::Foreground - general foreground color.
101
102 QColorGroup::Base - used as background color for text entry widgets,
103 for example; usually white or another light color.
104
105 QColorGroup::Text - the foreground color used with Base. Usually this
106 is the same as the Foreground, in which case it must provide good
107 contrast with Background and Base.
108
109 QColorGroup::Button - general button background color in which buttons
110 need a background different from Background, as in the Macintosh style.
111
112 QColorGroup::ButtonText - a foreground color used with the Button
113 color.
114
115 There are some color roles used mostly for 3D bevel and shadow effects:
116
117 QColorGroup::Light - lighter than Button color.
118
119 QColorGroup::Midlight - between Button and Light.
120
121 QColorGroup::Dark - darker than Button.
122
123 QColorGroup::Mid - between Button and Dark.
124
125 QColorGroup::Shadow - a very dark color. By default, the shadow color
126 is Qt::black.
127
128 All of these are normally derived from Background and used in ways that
129 depend on that relationship. For example, buttons depend on it to make
130 the bevels look attractive, and Motif scroll bars depend on Mid to be
131 slightly different from Background.
132
133 Selected (marked) items have two roles:
134
135 QColorGroup::Highlight - a color to indicate a selected item or the
136 current item. By default, the highlight color is Qt::darkBlue.
137
138 QColorGroup::HighlightedText - a text color that contrasts with
139 Highlight. By default, the highlighted text color is Qt::white.
140
141 Finally, there is a special role for text that needs to be drawn where
142 Text or Foreground would give poor contrast, such as on pressed push
143 buttons:
144
145 QColorGroup::BrightText - a text color that is very different from
146 Foreground and contrasts well with e.g. Dark.
147
148 QColorGroup::Link - a text color used for unvisited hyperlinks. By
149 default, the link color is Qt::blue.
150
151 QColorGroup::LinkVisited - a text color used for already visited
152 hyperlinks. By default, the linkvisited color is Qt::magenta.
153
154 QColorGroup::NColorRoles - Internal.
155
156 Note that text colors can be used for things other than just words;
157 text colors are usually used for text, but it's quite common to use the
158 text color roles for lines, icons, etc.
159
160 This image shows most of the color roles in use: <center>
161 [Image Omitted]
162
163 </center>
164
167 Constructs a color group with all colors set to black.
168
170 background, const QColor & light, const QColor & dark, const QColor &
171 mid, const QColor & text, const QColor & base )
172 This function is obsolete. It is provided to keep old source working.
173 We strongly advise against using it in new code.
174
175 Constructs a color group with the specified colors. The button color
176 will be set to the background color.
177
179 const QBrush & light, const QBrush & dark, const QBrush & mid, const
180 QBrush & text, const QBrush & bright_text, const QBrush & base, const
181 QBrush & background )
182 Constructs a color group. You can pass either brushes, pixmaps or plain
183 colors for foreground, button, light, dark, mid, text, bright_text,
184 base and background.
185
186 See also QBrush.
187
189 Constructs a color group that is an independent copy of other.
190
192 Destroys the color group.
193
195 Returns the background color of the color group.
196
197 See also ColorRole.
198
200 Returns the base color of the color group.
201
202 See also ColorRole.
203
205 Returns the bright text foreground color of the color group.
206
207 See also ColorRole.
208
209 Examples:
210
212 Returns the brush that has been set for color role r.
213
214 See also color(), setBrush(), and ColorRole.
215
216 Examples:
217
219 Returns the button color of the color group.
220
221 See also ColorRole.
222
223 Examples:
224
226 Returns the button text foreground color of the color group.
227
228 See also ColorRole.
229
230 Examples:
231
233 Returns the color that has been set for color role r.
234
235 See also brush() and ColorRole.
236
238 Returns the dark color of the color group.
239
240 See also ColorRole.
241
242 Example: themes/wood.cpp.
243
245 Returns the foreground color of the color group.
246
247 See also ColorRole.
248
249 Examples:
250
252 Returns the highlight color of the color group.
253
254 See also ColorRole.
255
257 Returns the highlighted text color of the color group.
258
259 See also ColorRole.
260
262 Returns the light color of the color group.
263
264 See also ColorRole.
265
266 Example: themes/wood.cpp.
267
269 Returns the unvisited link text color of the color group.
270
271 See also ColorRole.
272
274 Returns the visited link text color of the color group.
275
276 See also ColorRole.
277
279 Returns the mid color of the color group.
280
281 See also ColorRole.
282
283 Examples:
284
286 Returns the midlight color of the color group.
287
288 See also ColorRole.
289
291 Returns TRUE if this color group is different from g; otherwise returns
292 FALSE.
293
294 See also
295
297 Copies the colors of other to this color group.
298
300 Returns TRUE if this color group is equal to g; otherwise returns
301 FALSE.
302
303 See also
304
306 Sets the brush used for color role r to b.
307
308 See also brush(), setColor(), and ColorRole.
309
310 Example: themes/wood.cpp.
311
313 Sets the brush used for color role r to a solid color c.
314
315 See also brush() and ColorRole.
316
317 Examples:
318
320 Returns the shadow color of the color group.
321
322 See also ColorRole.
323
325 Returns the text foreground color of the color group.
326
327 See also ColorRole.
328
329 Example: listviews/listviews.cpp.
330
333 Writes color group, g to the stream s.
334
335 See also Format of the QDataStream operators.
336
337
339 http://doc.trolltech.com/qcolorgroup.html
340 http://www.trolltech.com/faq/tech.html
341
343 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
344 license file included in the distribution for a complete license
345 statement.
346
348 Generated automatically from the source code.
349
351 If you find a bug in Qt, please report it as described in
352 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
353 help you. Thank you.
354
355 The definitive Qt documentation is provided in HTML format; it is
356 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
357 web browser. This man page is provided as a convenience for those users
358 who prefer man pages, although this format is not officially supported
359 by Trolltech.
360
361 If you find errors in this manual page, please report them to qt-
362 bugs@trolltech.com. Please include the name of the manual page
363 (qcolorgroup.3qt) and the Qt version (3.3.8).
364
365
366
367Trolltech AS 2 February 2007 QColorGroup(3qt)