1QPalette(3qt)                                                    QPalette(3qt)
2
3
4

NAME

6       QPalette - Color groups for each widget state
7

SYNOPSIS

9       #include <qpalette.h>
10
11   Public Members
12       QPalette ()
13       QPalette ( const QColor & button )  (obsolete)
14       QPalette ( const QColor & button, const QColor & background )
15       QPalette ( const QColorGroup & active, const QColorGroup & disabled,
16           const QColorGroup & inactive )
17       QPalette ( const QPalette & p )
18       ~QPalette ()
19       QPalette & operator= ( const QPalette & p )
20       enum ColorGroup { Disabled, Active, Inactive, NColorGroups, Normal =
21           Active }
22       const QColor & color ( ColorGroup gr, QColorGroup::ColorRole r ) const
23       const QBrush & brush ( ColorGroup gr, QColorGroup::ColorRole r ) const
24       void setColor ( ColorGroup gr, QColorGroup::ColorRole r, const QColor &
25           c )
26       void setBrush ( ColorGroup gr, QColorGroup::ColorRole r, const QBrush &
27           b )
28       void setColor ( QColorGroup::ColorRole r, const QColor & c )
29       void setBrush ( QColorGroup::ColorRole r, const QBrush & b )
30       QPalette copy () const
31       const QColorGroup & active () const
32       const QColorGroup & disabled () const
33       const QColorGroup & inactive () const
34       const QColorGroup & normal () const  (obsolete)
35       void setActive ( const QColorGroup & g )
36       void setDisabled ( const QColorGroup & g )
37       void setInactive ( const QColorGroup & g )
38       void setNormal ( const QColorGroup & cg )  (obsolete)
39       bool operator== ( const QPalette & p ) const
40       bool operator!= ( const QPalette & p ) const
41       bool isCopyOf ( const QPalette & p )
42       int serialNumber () const
43
45       QDataStream & operator<< ( QDataStream & s, const QPalette & p )
46       QDataStream & operator>> ( QDataStream & s, QPalette & p )
47

DESCRIPTION

49       The QPalette class contains color groups for each widget state.
50
51       A palette consists of three color groups: active, disabled, and
52       inactive. All widgets contain a palette, and all widgets in Qt use
53       their palette to draw themselves. This makes the user interface easily
54       configurable and easier to keep consistent.
55
56       If you create a new widget we strongly recommend that you use the
57       colors in the palette rather than hard-coding specific colors.
58
59       The color groups:
60
61       The active() group is used for the window that has keyboard focus.
62
63       The inactive() group is used for other windows.
64
65       The disabled() group is used for widgets (not windows) that are
66       disabled for some reason.
67
68       Both active and inactive windows can contain disabled widgets.
69       (Disabled widgets are often called inaccessible or grayed out.)
70
71       In Motif style, active() and inactive() look the same. In Windows 2000
72       style and Macintosh Platinum style, the two styles look slightly
73       different.
74
75       There are setActive(), setInactive(), and setDisabled() functions to
76       modify the palette. (Qt also supports a normal() group; this is an
77       obsolete alias for active(), supported for backwards compatibility.)
78
79       Colors and brushes can be set for particular roles in any of a
80       palette's color groups with setColor() and setBrush().
81
82       You can copy a palette using the copy constructor and test to see if
83       two palettes are identical using isCopyOf().
84
85       See also QApplication::setPalette(), QWidget::palette, QColorGroup,
86       QColor, Widget Appearance and Style, Graphics Classes, Image Processing
87       Classes, and Implicitly and Explicitly Shared Classes.
88
89   Member Type Documentation

QPalette::ColorGroup

91       QPalette::Disabled
92
93       QPalette::Active
94
95       QPalette::Inactive
96
97       QPalette::NColorGroups
98
99       QPalette::Normal - synonym for Active
100

MEMBER FUNCTION DOCUMENTATION

QPalette::QPalette ()

103       Constructs a palette that consists of color groups with only black
104       colors.
105

QPalette::QPalette ( const QColor & button )

107       This function is obsolete. It is provided to keep old source working.
108       We strongly advise against using it in new code.
109
110       Constructs a palette from the button color. The other colors are
111       automatically calculated, based on this color. Background will be the
112       button color as well.
113

QPalette::QPalette ( const QColor & button, const QColor & background )

115       Constructs a palette from a button color and a background. The other
116       colors are automatically calculated, based on these colors.
117

QPalette::QPalette ( const QColorGroup & active, const QColorGroup & disabled,

119       const QColorGroup & inactive )
120       Constructs a palette that consists of the three color groups active,
121       disabled and inactive. See the Detailed Description for definitions of
122       the color groups and QColorGroup::ColorRole for definitions of each
123       color role in the three groups.
124
125       See also QColorGroup and QColorGroup::ColorRole.
126

QPalette::QPalette ( const QPalette & p )

128       Constructs a copy of p.
129
130       This constructor is fast (it uses copy-on-write).
131

QPalette::~QPalette ()

133       Destroys the palette.
134

const QColorGroup & QPalette::active () const

136       Returns the active color group of this palette.
137
138       See also QColorGroup, setActive(), inactive(), and disabled().
139
140       Examples:
141

const QBrush & QPalette::brush ( ColorGroup gr, QColorGroup::ColorRole r )

143       const
144       Returns the brush in color group gr, used for color role r.
145
146       See also color(), setBrush(), and QColorGroup::ColorRole.
147

const QColor & QPalette::color ( ColorGroup gr, QColorGroup::ColorRole r )

149       const
150       Returns the color in color group gr, used for color role r.
151
152       See also brush(), setColor(), and QColorGroup::ColorRole.
153

QPalette QPalette::copy () const

155       Returns a deep copy of this palette.
156
157       Warning: This is slower than the copy constructor and assignment
158       operator and offers no benefits.
159

const QColorGroup & QPalette::disabled () const

161       Returns the disabled color group of this palette.
162
163       See also QColorGroup, setDisabled(), active(), and inactive().
164
165       Examples:
166

const QColorGroup & QPalette::inactive () const

168       Returns the inactive color group of this palette.
169
170       See also QColorGroup, setInactive(), active(), and disabled().
171

bool QPalette::isCopyOf ( const QPalette & p )

173       Returns TRUE if this palette and p are copies of each other, i.e. one
174       of them was created as a copy of the other and neither was subsequently
175       modified; otherwise returns FALSE. This is much stricter than equality.
176
177       See also operator=() and operator==().
178

const QColorGroup & QPalette::normal () const

180       This function is obsolete. It is provided to keep old source working.
181       We strongly advise against using it in new code.
182
183       Returns the active color group. Use active() instead.
184
185       See also setActive() and active().
186

bool QPalette::operator!= ( const QPalette & p ) const

188       Returns TRUE (slowly) if this palette is different from p; otherwise
189       returns FALSE (usually quickly).
190

QPalette & QPalette::operator= ( const QPalette & p )

192       Assigns p to this palette and returns a reference to this palette.
193
194       This is fast (it uses copy-on-write).
195
196       See also copy().
197

bool QPalette::operator== ( const QPalette & p ) const

199       Returns TRUE (usually quickly) if this palette is equal to p; otherwise
200       returns FALSE (slowly).
201

int QPalette::serialNumber () const

203       Returns a number that uniquely identifies this QPalette object. The
204       serial number is intended for caching. Its value may not be used for
205       anything other than equality testing.
206
207       Note that QPalette uses copy-on-write, and the serial number changes
208       during the lazy copy operation (detach()), not during a shallow copy
209       (copy constructor or assignment).
210
211       See also QPixmap, QPixmapCache, and QCache.
212

void QPalette::setActive ( const QColorGroup & g )

214       Sets the Active color group to g.
215
216       See also active(), setDisabled(), setInactive(), and QColorGroup.
217

void QPalette::setBrush ( ColorGroup gr, QColorGroup::ColorRole r, const

219       QBrush & b )
220       Sets the brush in color group gr, used for color role r, to b.
221
222       See also brush(), setColor(), and QColorGroup::ColorRole.
223

void QPalette::setBrush ( QColorGroup::ColorRole r, const QBrush & b )

225       This is an overloaded member function, provided for convenience. It
226       behaves essentially like the above function.
227
228       Sets the brush in for color role r in all three color groups to b.
229
230       See also brush(), setColor(), QColorGroup::ColorRole, active(),
231       inactive(), and disabled().
232

void QPalette::setColor ( ColorGroup gr, QColorGroup::ColorRole r, const

234       QColor & c )
235       Sets the brush in color group gr, used for color role r, to the solid
236       color c.
237
238       See also setBrush(), color(), and QColorGroup::ColorRole.
239
240       Example: themes/themes.cpp.
241

void QPalette::setColor ( QColorGroup::ColorRole r, const QColor & c )

243       This is an overloaded member function, provided for convenience. It
244       behaves essentially like the above function.
245
246       Sets the brush color used for color role r to color c in all three
247       color groups.
248
249       See also color(), setBrush(), and QColorGroup::ColorRole.
250

void QPalette::setDisabled ( const QColorGroup & g )

252       Sets the Disabled color group to g.
253
254       See also disabled(), setActive(), and setInactive().
255

void QPalette::setInactive ( const QColorGroup & g )

257       Sets the Inactive color group to g.
258
259       See also active(), setDisabled(), setActive(), and QColorGroup.
260

void QPalette::setNormal ( const QColorGroup & cg )

262       This function is obsolete. It is provided to keep old source working.
263       We strongly advise against using it in new code.
264
265       Sets the active color group to cg. Use setActive() instead.
266
267       See also setActive() and active().
268

QDataStream & operator<< ( QDataStream & s, const QPalette & p )

271       Writes the palette, p to the stream s and returns a reference to the
272       stream.
273
274       See also Format of the QDataStream operators.
275

QDataStream & operator>> ( QDataStream & s, QPalette & p )

277       Reads a palette from the stream, s into the palette p, and returns a
278       reference to the stream.
279
280       See also Format of the QDataStream operators.
281
282

SEE ALSO

284       http://doc.trolltech.com/qpalette.html
285       http://www.trolltech.com/faq/tech.html
286
288       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
289       license file included in the distribution for a complete license
290       statement.
291

AUTHOR

293       Generated automatically from the source code.
294

BUGS

296       If you find a bug in Qt, please report it as described in
297       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
298       help you. Thank you.
299
300       The definitive Qt documentation is provided in HTML format; it is
301       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
302       web browser. This man page is provided as a convenience for those users
303       who prefer man pages, although this format is not officially supported
304       by Trolltech.
305
306       If you find errors in this manual page, please report them to qt-
307       bugs@trolltech.com.  Please include the name of the manual page
308       (qpalette.3qt) and the Qt version (3.3.8).
309
310
311
312Trolltech AS                    2 February 2007                  QPalette(3qt)
Impressum