Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |
The QPalette class contains color groups for each widget state. More...
#include <qpalette.h>
The QPalette class contains color groups for each widget state.
A palette consists of three color groups: active, disabled, and inactive. All widgets contain a palette, and all widgets in Qt 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.
The color groups:
Both active and inactive windows can contain disabled widgets. (Disabled widgets are often called inaccessible or grayed out.)
In Motif style, active() and inactive() look the same. In Windows 2000 style and Macintosh Platinum style, the two styles look slightly different.
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.)
Colors and brushes can be set for particular roles in any of a palette's color groups with setColor() and setBrush().
You can copy a palette using the copy constructor and test to see if two palettes are identical using isCopyOf().
See also QApplication::setPalette(), QWidget::palette, QColorGroup, QColor, Widget Appearance and Style, Graphics Classes, Image Processing Classes, and Implicitly and Explicitly Shared Classes.
Constructs a palette from the button color. The other colors are automatically calculated, based on this color. Background will be the button color as well.
See also QColorGroup and QColorGroup::ColorRole.
This constructor is fast (it uses copy-on-write).
Returns the active color group of this palette.
See also QColorGroup, setActive(), inactive(), and disabled().
Examples: themes/metal.cpp and themes/wood.cpp.
See also color(), setBrush(), and QColorGroup::ColorRole.
See also brush(), setColor(), and QColorGroup::ColorRole.
Warning: This is slower than the copy constructor and assignment operator and offers no benefits.
Returns the disabled color group of this palette.
See also QColorGroup, setDisabled(), active(), and inactive().
Examples: themes/metal.cpp and themes/wood.cpp.
Returns the inactive color group of this palette.
See also QColorGroup, setInactive(), active(), and disabled().
See also operator=() and operator==().
Returns the active color group. Use active() instead.
See also setActive() and active().
Returns TRUE (slowly) if this palette is different from p; otherwise returns FALSE (usually quickly).
This is fast (it uses copy-on-write).
See also copy().
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.
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).
See also QPixmap, QPixmapCache, and QCache.
See also active(), setDisabled(), setInactive(), and QColorGroup.
See also brush(), setColor(), and QColorGroup::ColorRole.
Sets the brush in for color role r in all three color groups to b.
See also brush(), setColor(), QColorGroup::ColorRole, active(), inactive(), and disabled().
See also setBrush(), color(), and QColorGroup::ColorRole.
Example: themes/themes.cpp.
Sets the brush color used for color role r to color c in all three color groups.
See also color(), setBrush(), and QColorGroup::ColorRole.
See also disabled(), setActive(), and setInactive().
See also active(), setDisabled(), setActive(), and QColorGroup.
Sets the active color group to cg. Use setActive() instead.
See also setActive() and active().
Writes the palette, p to the stream s and returns a reference to the stream.
See also Format of the QDataStream operators.
Reads a palette from the stream, s into the palette p, and returns a reference to the stream.
See also Format of the QDataStream operators.
This file is part of the Qt toolkit. Copyright © 1995-2003 Trolltech. All Rights Reserved.
Copyright © 2003 Trolltech | Trademarks | Qt version 3.2.0b2
|