A palette consists of three color groups: \fIactive\fR, \fIdisabled\fR, and \fIinactive\fR. All widgets contain a palette, and all widgets in TQt use their palette to draw themselves. This makes the user interface easily configurable and easier to keep consistent.
If you create a new widget we strongly recommend that you use the colors in the palette rather than hard-coding specific colors.
.PP
The color groups:
.TP
The active() group is used for the window that has keyboard focus.
.TP
The inactive() group is used for other windows.
.TP
The disabled() group is used for widgets (not windows) that are disabled for some reason.
.PP
Both active and inactive windows can contain disabled widgets. (Disabled widgets are often called \fIinaccessible\fR or \fIgrayed out\fR.)
.PP
In Motif style, active() and inactive() look the same. In Windows 2000 style and Macintosh Platinum style, the two styles look slightly different.
.PP
There are setActive(), setInactive(), and setDisabled() functions to modify the palette. (Qt also supports a normal() group; this is an obsolete alias for active(), supported for backwards compatibility.)
.PP
Colors and brushes can be set for particular roles in any of a palette's color groups with setColor() and setBrush().
.PP
You can copy a palette using the copy constructor and test to see if two palettes are \fIidentical\fR using isCopyOf().
.PP
See also QApplication::setPalette(), QWidget::palette, QColorGroup, QColor, Widget Appearance and Style, Graphics Classes, Image Processing Classes, and Implicitly and Explicitly Shared Classes.
.SS "Member Type Documentation"
.SH "QPalette::ColorGroup"
.TP
\fCQPalette::Disabled\fR
.TP
\fCQPalette::Active\fR
.TP
\fCQPalette::Inactive\fR
.TP
\fCQPalette::NColorGroups\fR
.TP
\fCQPalette::Normal\fR - synonym for Active
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QPalette::QPalette ()"
Constructs a palette that consists of color groups with only black colors.
\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 palette from the \fIbutton\fR color. The other colors are automatically calculated, based on this color. Background will be the button color as well.
Constructs a palette that consists of the three color groups \fIactive\fR, \fIdisabled\fR and \fIinactive\fR. See the Detailed Description for definitions of the color groups and QColorGroup::ColorRole for definitions of each color role in the three groups.
See also QColorGroup, setInactive(), active(), and disabled().
.SH "bool QPalette::isCopyOf ( const QPalette & p )"
Returns TRUE if this palette and \fIp\fR are copies of each other, i.e. one of them was created as a copy of the other and neither was subsequently modified; otherwise returns FALSE. This is much stricter than equality.
Returns a number that uniquely identifies this QPalette object. The serial number is intended for caching. Its value may not be used for anything other than equality testing.
.PP
Note that QPalette uses copy-on-write, and the serial number changes during the lazy copy operation (detach()), not during a shallow copy (copy constructor or assignment).
.PP
See also QPixmap, QPixmapCache, and QCache.
.SH "void QPalette::setActive ( const QColorGroup & g )"
Sets the Active color group to \fIg\fR.
.PP
See also active(), setDisabled(), setInactive(), and QColorGroup.