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.
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.
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.