File: qpalette.html

package info (click to toggle)
python-qt4 4.12.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 40,300 kB
  • ctags: 6,185
  • sloc: python: 125,988; cpp: 13,291; xml: 292; makefile: 246; php: 27; sh: 2
file content (505 lines) | stat: -rw-r--r-- 38,246 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QPalette Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QPalette Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QPalette class contains color groups for each widget state.
<a href="#details">More...</a></p>

<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qpalette.html#ColorGroup-enum">ColorGroup</a></b> { Active, Disabled, Inactive, NColorGroups, ..., Normal }</li><li><div class="fn" />enum <b><a href="qpalette.html#ColorRole-enum">ColorRole</a></b> { WindowText, Foreground, Button, Light, ..., NoRole }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qpalette.html#QPalette">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpalette.html#QPalette-2">__init__</a></b> (<i>self</i>, QColor&#160;<i>button</i>)</li><li><div class="fn" /><b><a href="qpalette.html#QPalette-3">__init__</a></b> (<i>self</i>, Qt.GlobalColor&#160;<i>button</i>)</li><li><div class="fn" /><b><a href="qpalette.html#QPalette-4">__init__</a></b> (<i>self</i>, QColor&#160;<i>button</i>, QColor&#160;<i>background</i>)</li><li><div class="fn" /><b><a href="qpalette.html#QPalette-5">__init__</a></b> (<i>self</i>, QBrush&#160;<i>foreground</i>, QBrush&#160;<i>button</i>, QBrush&#160;<i>light</i>, QBrush&#160;<i>dark</i>, QBrush&#160;<i>mid</i>, QBrush&#160;<i>text</i>, QBrush&#160;<i>bright_text</i>, QBrush&#160;<i>base</i>, QBrush&#160;<i>background</i>)</li><li><div class="fn" /><b><a href="qpalette.html#QPalette-6">__init__</a></b> (<i>self</i>, QColor&#160;<i>foreground</i>, QColor&#160;<i>background</i>, QColor&#160;<i>light</i>, QColor&#160;<i>dark</i>, QColor&#160;<i>mid</i>, QColor&#160;<i>text</i>, QColor&#160;<i>base</i>)</li><li><div class="fn" /><b><a href="qpalette.html#QPalette-7">__init__</a></b> (<i>self</i>, QPalette&#160;<i>palette</i>)</li><li><div class="fn" /><b><a href="qpalette.html#QPalette-8">__init__</a></b> (<i>self</i>, QVariant&#160;<i>variant</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#alternateBase">alternateBase</a></b> (<i>self</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#background">background</a></b> (<i>self</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#base">base</a></b> (<i>self</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#brightText">brightText</a></b> (<i>self</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#brush">brush</a></b> (<i>self</i>, ColorGroup&#160;<i>cg</i>, ColorRole&#160;<i>cr</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#brush-2">brush</a></b> (<i>self</i>, ColorRole&#160;<i>cr</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#button">button</a></b> (<i>self</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#buttonText">buttonText</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpalette.html#cacheKey">cacheKey</a></b> (<i>self</i>)</li><li><div class="fn" />QColor <b><a href="qpalette.html#color">color</a></b> (<i>self</i>, ColorGroup&#160;<i>cg</i>, ColorRole&#160;<i>cr</i>)</li><li><div class="fn" />QColor <b><a href="qpalette.html#color-2">color</a></b> (<i>self</i>, ColorRole&#160;<i>cr</i>)</li><li><div class="fn" />ColorGroup <b><a href="qpalette.html#currentColorGroup">currentColorGroup</a></b> (<i>self</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#dark">dark</a></b> (<i>self</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#foreground">foreground</a></b> (<i>self</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#highlight">highlight</a></b> (<i>self</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#highlightedText">highlightedText</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpalette.html#isBrushSet">isBrushSet</a></b> (<i>self</i>, ColorGroup&#160;<i>cg</i>, ColorRole&#160;<i>cr</i>)</li><li><div class="fn" />bool <b><a href="qpalette.html#isCopyOf">isCopyOf</a></b> (<i>self</i>, QPalette&#160;<i>p</i>)</li><li><div class="fn" />bool <b><a href="qpalette.html#isEqual">isEqual</a></b> (<i>self</i>, ColorGroup&#160;<i>cr1</i>, ColorGroup&#160;<i>cr2</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#light">light</a></b> (<i>self</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#link">link</a></b> (<i>self</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#linkVisited">linkVisited</a></b> (<i>self</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#mid">mid</a></b> (<i>self</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#midlight">midlight</a></b> (<i>self</i>)</li><li><div class="fn" />QPalette <b><a href="qpalette.html#resolve">resolve</a></b> (<i>self</i>, QPalette)</li><li><div class="fn" />int <b><a href="qpalette.html#resolve-2">resolve</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpalette.html#resolve-3">resolve</a></b> (<i>self</i>, int&#160;<i>mask</i>)</li><li><div class="fn" />int <b><a href="qpalette.html#serialNumber">serialNumber</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpalette.html#setBrush">setBrush</a></b> (<i>self</i>, ColorGroup&#160;<i>cg</i>, ColorRole&#160;<i>cr</i>, QBrush&#160;<i>brush</i>)</li><li><div class="fn" /><b><a href="qpalette.html#setBrush-2">setBrush</a></b> (<i>self</i>, ColorRole&#160;<i>acr</i>, QBrush&#160;<i>abrush</i>)</li><li><div class="fn" /><b><a href="qpalette.html#setColor">setColor</a></b> (<i>self</i>, ColorGroup&#160;<i>acg</i>, ColorRole&#160;<i>acr</i>, QColor&#160;<i>acolor</i>)</li><li><div class="fn" /><b><a href="qpalette.html#setColor-2">setColor</a></b> (<i>self</i>, ColorRole&#160;<i>acr</i>, QColor&#160;<i>acolor</i>)</li><li><div class="fn" /><b><a href="qpalette.html#setColorGroup">setColorGroup</a></b> (<i>self</i>, ColorGroup&#160;<i>cr</i>, QBrush&#160;<i>foreground</i>, QBrush&#160;<i>button</i>, QBrush&#160;<i>light</i>, QBrush&#160;<i>dark</i>, QBrush&#160;<i>mid</i>, QBrush&#160;<i>text</i>, QBrush&#160;<i>bright_text</i>, QBrush&#160;<i>base</i>, QBrush&#160;<i>background</i>)</li><li><div class="fn" /><b><a href="qpalette.html#setCurrentColorGroup">setCurrentColorGroup</a></b> (<i>self</i>, ColorGroup&#160;<i>cg</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#shadow">shadow</a></b> (<i>self</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#text">text</a></b> (<i>self</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#toolTipBase">toolTipBase</a></b> (<i>self</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#toolTipText">toolTipText</a></b> (<i>self</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#window">window</a></b> (<i>self</i>)</li><li><div class="fn" />QBrush <b><a href="qpalette.html#windowText">windowText</a></b> (<i>self</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="qpalette.html#__eq__">__eq__</a></b> (<i>self</i>, QPalette&#160;<i>p</i>)</li><li><div class="fn" />bool <b><a href="qpalette.html#__ne__">__ne__</a></b> (<i>self</i>, QPalette&#160;<i>p</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QPalette class contains color groups for each widget
state.</p>
<p>A palette consists of three color groups: <i>Active</i>,
<i>Disabled</i>, and <i>Inactive</i>. All widgets in Qt contain a
palette and use their palette to draw themselves. This makes the
user interface easily configurable and easier to keep
consistent.</p>
<p>If you create a new widget we strongly recommend that you use
the colors in the palette rather than hard-coding specific
colors.</p>
<p>The color groups:</p>
<ul>
<li>The Active group is used for the window that has keyboard
focus.</li>
<li>The Inactive group is used for other windows.</li>
<li>The Disabled group is used for widgets (not windows) that are
disabled for some reason.</li>
</ul>
<p>Both active and inactive windows can contain disabled widgets.
(Disabled widgets are often called <i>inaccessible</i> or <i>grayed
out</i>.)</p>
<p>In most styles, Active and Inactive look the same.</p>
<p>Colors and brushes can be set for particular roles in any of a
palette's color groups with <a href="qpalette.html#setColor">setColor</a>() and <a href="qpalette.html#setBrush">setBrush</a>(). A color group contains a
group of colors used by widgets for drawing themselves. We
recommend that widgets use color group roles from the palette such
as "foreground" and "base" rather than literal colors like "red" or
"turquoise". The color roles are enumerated and defined in the
<a href="qpalette.html#ColorRole-enum">ColorRole</a>
documentation.</p>
<p>We strongly recommend that you use the default palette of the
current style (returned by <a href="qapplication.html#palette">QApplication.palette</a>()) and modify
that as necessary. This is done by Qt's widgets when they are
drawn.</p>
<p>To modify a color group you call the functions <a href="qpalette.html#setColor">setColor</a>() and <a href="qpalette.html#setBrush">setBrush</a>(), depending on whether you
want a pure color or a pixmap pattern.</p>
<p>There are also corresponding <a href="qpalette.html#color">color</a>() and <a href="qpalette.html#brush">brush</a>() getters, and a commonly used
convenience function to get the <a href="qpalette.html#ColorRole-enum">ColorRole</a> for the current
<a href="qpalette.html#ColorGroup-enum">ColorGroup</a>: <a href="qpalette.html#window">window</a>(), <a href="qpalette.html#windowText">windowText</a>(), <a href="qpalette.html#base">base</a>(), etc.</p>
<p>You can copy a palette using the copy constructor and test to
see if two palettes are <i>identical</i> using <a href="qpalette.html#isCopyOf">isCopyOf</a>().</p>
<p>QPalette is optimized by the use of <a href="implicit-sharing.html">implicit sharing</a>, so it is very
efficient to pass QPalette objects as arguments.</p>
<p><b>Warning:</b> Some styles do not use the palette for all
drawing, for instance, if they make use of native theme engines.
This is the case for both the Windows XP, Windows Vista, and the
Mac OS X styles.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="ColorGroup-enum" />QPalette.ColorGroup</h3><table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.Disabled</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">&#160;</td>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.Active</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">&#160;</td>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.Inactive</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">&#160;</td>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.Normal</tt></td>
<td class="topAlign"><tt>Active</tt></td>
<td class="topAlign">synonym for Active</td>
</tr>
</table>


<h3 class="fn"><a name="ColorRole-enum" />QPalette.ColorRole</h3><p class="centerAlign"><img alt="Color Roles" src="images/palette.png" /></p>
<p>The ColorRole enum defines the different symbolic color roles
used in current GUIs.</p>
<p>The central roles are:</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.Window</tt></td>
<td class="topAlign"><tt>10</tt></td>
<td class="topAlign">A general background color.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.Background</tt></td>
<td class="topAlign"><tt>Window</tt></td>
<td class="topAlign">This value is obsolete. Use Window
instead.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.WindowText</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">A general foreground color.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.Foreground</tt></td>
<td class="topAlign"><tt>WindowText</tt></td>
<td class="topAlign">This value is obsolete. Use WindowText
instead.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.Base</tt></td>
<td class="topAlign"><tt>9</tt></td>
<td class="topAlign">Used mostly as the background color for text
entry widgets, but can also be used for other painting - such as
the background of combobox drop down lists and toolbar handles. It
is usually white or another light color.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.AlternateBase</tt></td>
<td class="topAlign"><tt>16</tt></td>
<td class="topAlign">Used as the alternate background color in
views with alternating row colors (see <a href="qabstractitemview.html#alternatingRowColors-prop">QAbstractItemView.setAlternatingRowColors</a>()).</td>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.ToolTipBase</tt></td>
<td class="topAlign"><tt>18</tt></td>
<td class="topAlign">Used as the background color for <a href="qtooltip.html">QToolTip</a> and <a href="qwhatsthis.html">QWhatsThis</a>. Tool tips use the Inactive color
group of <a href="qpalette.html">QPalette</a>, because tool tips
are not active windows.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.ToolTipText</tt></td>
<td class="topAlign"><tt>19</tt></td>
<td class="topAlign">Used as the foreground color for <a href="qtooltip.html">QToolTip</a> and <a href="qwhatsthis.html">QWhatsThis</a>. Tool tips use the Inactive color
group of <a href="qpalette.html">QPalette</a>, because tool tips
are not active windows.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.Text</tt></td>
<td class="topAlign"><tt>6</tt></td>
<td class="topAlign">The foreground color used with <tt>Base</tt>.
This is usually the same as the <tt>WindowText</tt>, in which case
it must provide good contrast with <tt>Window</tt> and
<tt>Base</tt>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.Button</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">The general button background color. This
background can be different from <tt>Window</tt> as some styles
require a different background color for buttons.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.ButtonText</tt></td>
<td class="topAlign"><tt>8</tt></td>
<td class="topAlign">A foreground color used with the
<tt>Button</tt> color.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.BrightText</tt></td>
<td class="topAlign"><tt>7</tt></td>
<td class="topAlign">A text color that is very different from
<tt>WindowText</tt>, and contrasts well with e.g. <tt>Dark</tt>.
Typically used for text that needs to be drawn where <tt>Text</tt>
or <tt>WindowText</tt> would give poor contrast, such as on pressed
push buttons. Note that text colors can be used for things other
than just words; text colors are <i>usually</i> used for text, but
it's quite common to use the text color roles for lines, icons,
etc.</td>
</tr>
</table>
<p>There are some color roles used mostly for 3D bevel and shadow
effects. All of these are normally derived from <tt>Window</tt>,
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 <tt>Mid</tt> to be slightly different from
<tt>Window</tt>.</p>
<table class="valuelist">
<tr class="even" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.Light</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">Lighter than <tt>Button</tt> color.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.Midlight</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign">Between <tt>Button</tt> and
<tt>Light</tt>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.Dark</tt></td>
<td class="topAlign"><tt>4</tt></td>
<td class="topAlign">Darker than <tt>Button</tt>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.Mid</tt></td>
<td class="topAlign"><tt>5</tt></td>
<td class="topAlign">Between <tt>Button</tt> and
<tt>Dark</tt>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.Shadow</tt></td>
<td class="topAlign"><tt>11</tt></td>
<td class="topAlign">A very dark color. By default, the shadow
color is <a href="qt.html#GlobalColor-enum">Qt.black</a>.</td>
</tr>
</table>
<p>Selected (marked) items have two roles:</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.Highlight</tt></td>
<td class="topAlign"><tt>12</tt></td>
<td class="topAlign">A color to indicate a selected item or the
current item. By default, the highlight color is <a href="qt.html#GlobalColor-enum">Qt.darkBlue</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.HighlightedText</tt></td>
<td class="topAlign"><tt>13</tt></td>
<td class="topAlign">A text color that contrasts with
<tt>Highlight</tt>. By default, the highlighted text color is
<a href="qt.html#GlobalColor-enum">Qt.white</a>.</td>
</tr>
</table>
<p>There are two color roles related to hyperlinks:</p>
<table class="valuelist">
<tr class="even" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.Link</tt></td>
<td class="topAlign"><tt>14</tt></td>
<td class="topAlign">A text color used for unvisited hyperlinks. By
default, the link color is <a href="qt.html#GlobalColor-enum">Qt.blue</a>.</td>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.LinkVisited</tt></td>
<td class="topAlign"><tt>15</tt></td>
<td class="topAlign">A text color used for already visited
hyperlinks. By default, the linkvisited color is <a href="qt.html#GlobalColor-enum">Qt.magenta</a>.</td>
</tr>
</table>
<p>Note that we do not use the <tt>Link</tt> and
<tt>LinkVisited</tt> roles when rendering rich text in Qt, and that
we recommend that you use CSS and the <a href="qtextdocument.html#defaultStyleSheet-prop">QTextDocument.setDefaultStyleSheet</a>()
function to alter the appearance of links. For example:</p>
<pre class="cpp">
     <span class="type"><a href="qtextbrowser.html">QTextBrowser</a></span> browser;
     <span class="type"><a href="qcolor.html">QColor</a></span> linkColor(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>red);
     <span class="type"><a href="qstring.html">QString</a></span> sheet <span class="operator">=</span> <span class="type"><a href="qstring.html">QString</a></span><span class="operator">.</span>fromLatin1(<span class="string">"a { text-decoration: underline; color: %1 }"</span>)<span class="operator">.</span>arg(linkColor<span class="operator">.</span>name());
     browser<span class="operator">.</span>document()<span class="operator">-</span><span class="operator">&gt;</span>setDefaultStyleSheet(sheet);
</pre>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QPalette.NoRole</tt></td>
<td class="topAlign"><tt>17</tt></td>
<td class="topAlign">No role; this special role is often used to
indicate that a role has not been assigned.</td>
</tr>
</table>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QPalette" />QPalette.__init__ (<i>self</i>)</h3><p>Constructs a palette object that uses the application's default
palette.</p>
<p><b>See also</b> <a href="qapplication.html#setPalette">QApplication.setPalette</a>() and
<a href="qapplication.html#palette">QApplication.palette</a>().</p>


<h3 class="fn"><a name="QPalette-2" />QPalette.__init__ (<i>self</i>, <a href="qcolor.html">QColor</a>&#160;<i>button</i>)</h3><p>Constructs a palette from the <i>button</i> color. The other
colors are automatically calculated, based on this color.
<tt>Window</tt> will be the button color as well.</p>


<h3 class="fn"><a name="QPalette-3" />QPalette.__init__ (<i>self</i>, <a href="qt.html#GlobalColor-enum">Qt.GlobalColor</a>&#160;<i>button</i>)</h3><p>Constructs a palette from the <i>button</i> color. The other
colors are automatically calculated, based on this color.
<tt>Window</tt> will be the button color as well.</p>


<h3 class="fn"><a name="QPalette-4" />QPalette.__init__ (<i>self</i>, <a href="qcolor.html">QColor</a>&#160;<i>button</i>, <a href="qcolor.html">QColor</a>&#160;<i>background</i>)</h3><p>Constructs a palette from a <i>button</i> color and a
<i>window</i>. The other colors are automatically calculated, based
on these colors.</p>


<h3 class="fn"><a name="QPalette-5" />QPalette.__init__ (<i>self</i>, <a href="qbrush.html">QBrush</a>&#160;<i>foreground</i>, <a href="qbrush.html">QBrush</a>&#160;<i>button</i>, <a href="qbrush.html">QBrush</a>&#160;<i>light</i>, <a href="qbrush.html">QBrush</a>&#160;<i>dark</i>, <a href="qbrush.html">QBrush</a>&#160;<i>mid</i>, <a href="qbrush.html">QBrush</a>&#160;<i>text</i>, <a href="qbrush.html">QBrush</a>&#160;<i>bright_text</i>, <a href="qbrush.html">QBrush</a>&#160;<i>base</i>, <a href="qbrush.html">QBrush</a>&#160;<i>background</i>)</h3><p>Constructs a palette. You can pass either brushes, pixmaps or
plain colors for <i>windowText</i>, <i>button</i>, <i>light</i>,
<i>dark</i>, <i>mid</i>, <i>text</i>, <i>bright_text</i>,
<i>base</i> and <i>window</i>.</p>
<p><b>See also</b> <a href="qbrush.html">QBrush</a>.</p>


<h3 class="fn"><a name="QPalette-6" />QPalette.__init__ (<i>self</i>, <a href="qcolor.html">QColor</a>&#160;<i>foreground</i>, <a href="qcolor.html">QColor</a>&#160;<i>background</i>, <a href="qcolor.html">QColor</a>&#160;<i>light</i>, <a href="qcolor.html">QColor</a>&#160;<i>dark</i>, <a href="qcolor.html">QColor</a>&#160;<i>mid</i>, <a href="qcolor.html">QColor</a>&#160;<i>text</i>, <a href="qcolor.html">QColor</a>&#160;<i>base</i>)</h3><h3 class="fn"><a name="QPalette-7" />QPalette.__init__ (<i>self</i>, <a href="qpalette.html">QPalette</a>&#160;<i>palette</i>)</h3><h3 class="fn"><a name="QPalette-8" />QPalette.__init__ (<i>self</i>, QVariant&#160;<i>variant</i>)</h3><p>Constructs a copy of <i>p</i>.</p>
<p>This constructor is fast thanks to <a href="implicit-sharing.html">implicit sharing</a>.</p>


<h3 class="fn"><a name="alternateBase" /><a href="qbrush.html">QBrush</a> QPalette.alternateBase (<i>self</i>)</h3><p>Returns the alternate base brush of the current color group.</p>
<p><b>See also</b> <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>


<h3 class="fn"><a name="background" /><a href="qbrush.html">QBrush</a> QPalette.background (<i>self</i>)</h3><h3 class="fn"><a name="base" /><a href="qbrush.html">QBrush</a> QPalette.base (<i>self</i>)</h3><p>Returns the base brush of the current color group.</p>
<p><b>See also</b> <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>


<h3 class="fn"><a name="brightText" /><a href="qbrush.html">QBrush</a> QPalette.brightText (<i>self</i>)</h3><p>Returns the bright text foreground brush of the current color
group.</p>
<p><b>See also</b> <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>


<h3 class="fn"><a name="brush" /><a href="qbrush.html">QBrush</a> QPalette.brush (<i>self</i>, <a href="qpalette.html#ColorGroup-enum">ColorGroup</a>&#160;<i>cg</i>, <a href="qpalette.html#ColorRole-enum">ColorRole</a>&#160;<i>cr</i>)</h3><p>Returns the brush in the specified color <i>group</i>, used for
the given color <i>role</i>.</p>
<p><b>See also</b> <a href="qpalette.html#color">color</a>(),
<a href="qpalette.html#setBrush">setBrush</a>(), and <a href="qpalette.html#ColorRole-enum">ColorRole</a>.</p>


<h3 class="fn"><a name="brush-2" /><a href="qbrush.html">QBrush</a> QPalette.brush (<i>self</i>, <a href="qpalette.html#ColorRole-enum">ColorRole</a>&#160;<i>cr</i>)</h3><p>This is an overloaded function.</p>
<p>Returns the brush that has been set for the given color
<i>role</i> in the current <a href="qpalette.html#ColorGroup-enum">ColorGroup</a>.</p>
<p><b>See also</b> <a href="qpalette.html#color">color</a>(),
<a href="qpalette.html#setBrush">setBrush</a>(), and <a href="qpalette.html#ColorRole-enum">ColorRole</a>.</p>


<h3 class="fn"><a name="button" /><a href="qbrush.html">QBrush</a> QPalette.button (<i>self</i>)</h3><p>Returns the button brush of the current color group.</p>
<p><b>See also</b> <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>


<h3 class="fn"><a name="buttonText" /><a href="qbrush.html">QBrush</a> QPalette.buttonText (<i>self</i>)</h3><p>Returns the button text foreground brush of the current color
group.</p>
<p><b>See also</b> <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>


<h3 class="fn"><a name="cacheKey" />int QPalette.cacheKey (<i>self</i>)</h3><p>Returns a number that identifies the contents of this <a href="qpalette.html">QPalette</a> object. Distinct <a href="qpalette.html">QPalette</a> objects can have the same key if they
refer to the same contents.</p>
<p>The cacheKey() will change when the palette is altered.</p>


<h3 class="fn"><a name="color" /><a href="qcolor.html">QColor</a> QPalette.color (<i>self</i>, <a href="qpalette.html#ColorGroup-enum">ColorGroup</a>&#160;<i>cg</i>, <a href="qpalette.html#ColorRole-enum">ColorRole</a>&#160;<i>cr</i>)</h3><p>Returns the color in the specified color <i>group</i>, used for
the given color <i>role</i>.</p>
<p><b>See also</b> <a href="qpalette.html#brush">brush</a>(),
<a href="qpalette.html#setColor">setColor</a>(), and <a href="qpalette.html#ColorRole-enum">ColorRole</a>.</p>


<h3 class="fn"><a name="color-2" /><a href="qcolor.html">QColor</a> QPalette.color (<i>self</i>, <a href="qpalette.html#ColorRole-enum">ColorRole</a>&#160;<i>cr</i>)</h3><p>This is an overloaded function.</p>
<p>Returns the color that has been set for the given color
<i>role</i> in the current <a href="qpalette.html#ColorGroup-enum">ColorGroup</a>.</p>
<p><b>See also</b> <a href="qpalette.html#brush">brush</a>() and
<a href="qpalette.html#ColorRole-enum">ColorRole</a>.</p>


<h3 class="fn"><a name="currentColorGroup" /><a href="qpalette.html#ColorGroup-enum">ColorGroup</a> QPalette.currentColorGroup (<i>self</i>)</h3><p>Returns the palette's current color group.</p>
<p><b>See also</b> <a href="qpalette.html#setCurrentColorGroup">setCurrentColorGroup</a>().</p>


<h3 class="fn"><a name="dark" /><a href="qbrush.html">QBrush</a> QPalette.dark (<i>self</i>)</h3><p>Returns the dark brush of the current color group.</p>
<p><b>See also</b> <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>


<h3 class="fn"><a name="foreground" /><a href="qbrush.html">QBrush</a> QPalette.foreground (<i>self</i>)</h3><h3 class="fn"><a name="highlight" /><a href="qbrush.html">QBrush</a> QPalette.highlight (<i>self</i>)</h3><p>Returns the highlight brush of the current color group.</p>
<p><b>See also</b> <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>


<h3 class="fn"><a name="highlightedText" /><a href="qbrush.html">QBrush</a> QPalette.highlightedText (<i>self</i>)</h3><p>Returns the highlighted text brush of the current color
group.</p>
<p><b>See also</b> <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>


<h3 class="fn"><a name="isBrushSet" />bool QPalette.isBrushSet (<i>self</i>, <a href="qpalette.html#ColorGroup-enum">ColorGroup</a>&#160;<i>cg</i>, <a href="qpalette.html#ColorRole-enum">ColorRole</a>&#160;<i>cr</i>)</h3><p>Returns true if the <a href="qpalette.html#ColorGroup-enum">ColorGroup</a> <i>cg</i> and
<a href="qpalette.html#ColorRole-enum">ColorRole</a> <i>cr</i> has
been set previously on this palette; otherwise returns false.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qpalette.html#setBrush">setBrush</a>().</p>


<h3 class="fn"><a name="isCopyOf" />bool QPalette.isCopyOf (<i>self</i>, <a href="qpalette.html">QPalette</a>&#160;<i>p</i>)</h3><p>Returns true if this palette and <i>p</i> 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.</p>
<p><b>See also</b> <a href="qpalette.html#operator-eq">operator=</a>() and <a href="qpalette.html#operator-eq-eq">operator==</a>().</p>


<h3 class="fn"><a name="isEqual" />bool QPalette.isEqual (<i>self</i>, <a href="qpalette.html#ColorGroup-enum">ColorGroup</a>&#160;<i>cr1</i>, <a href="qpalette.html#ColorGroup-enum">ColorGroup</a>&#160;<i>cr2</i>)</h3><p>Returns true (usually quickly) if color group <i>cg1</i> is
equal to <i>cg2</i>; otherwise returns false.</p>


<h3 class="fn"><a name="light" /><a href="qbrush.html">QBrush</a> QPalette.light (<i>self</i>)</h3><p>Returns the light brush of the current color group.</p>
<p><b>See also</b> <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>


<h3 class="fn"><a name="link" /><a href="qbrush.html">QBrush</a> QPalette.link (<i>self</i>)</h3><p>Returns the unvisited link text brush of the current color
group.</p>
<p><b>See also</b> <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>


<h3 class="fn"><a name="linkVisited" /><a href="qbrush.html">QBrush</a> QPalette.linkVisited (<i>self</i>)</h3><p>Returns the visited link text brush of the current color
group.</p>
<p><b>See also</b> <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>


<h3 class="fn"><a name="mid" /><a href="qbrush.html">QBrush</a> QPalette.mid (<i>self</i>)</h3><p>Returns the mid brush of the current color group.</p>
<p><b>See also</b> <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>


<h3 class="fn"><a name="midlight" /><a href="qbrush.html">QBrush</a> QPalette.midlight (<i>self</i>)</h3><p>Returns the midlight brush of the current color group.</p>
<p><b>See also</b> <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>


<h3 class="fn"><a name="resolve" /><a href="qpalette.html">QPalette</a> QPalette.resolve (<i>self</i>, <a href="qpalette.html">QPalette</a>)</h3><p>Returns a new <a href="qpalette.html">QPalette</a> that has
attributes copied from <i>other</i>.</p>


<h3 class="fn"><a name="resolve-2" />int QPalette.resolve (<i>self</i>)</h3><h3 class="fn"><a name="resolve-3" />QPalette.resolve (<i>self</i>, int&#160;<i>mask</i>)</h3><h3 class="fn"><a name="serialNumber" />int QPalette.serialNumber (<i>self</i>)</h3><h3 class="fn"><a name="setBrush" />QPalette.setBrush (<i>self</i>, <a href="qpalette.html#ColorGroup-enum">ColorGroup</a>&#160;<i>cg</i>, <a href="qpalette.html#ColorRole-enum">ColorRole</a>&#160;<i>cr</i>, <a href="qbrush.html">QBrush</a>&#160;<i>brush</i>)</h3><p>Sets the brush for the given color <i>role</i> to the specified
<i>brush</i> for all groups in the palette.</p>
<p><b>See also</b> <a href="qpalette.html#brush">brush</a>(),
<a href="qpalette.html#setColor">setColor</a>(), and <a href="qpalette.html#ColorRole-enum">ColorRole</a>.</p>


<h3 class="fn"><a name="setBrush-2" />QPalette.setBrush (<i>self</i>, <a href="qpalette.html#ColorRole-enum">ColorRole</a>&#160;<i>acr</i>, <a href="qbrush.html">QBrush</a>&#160;<i>abrush</i>)</h3><p>This is an overloaded function.</p>
<p>Sets the brush in the specified color <i>group</i>, used for the
given color <i>role</i>, to <i>brush</i>.</p>
<p><b>See also</b> <a href="qpalette.html#brush">brush</a>(),
<a href="qpalette.html#setColor">setColor</a>(), and <a href="qpalette.html#ColorRole-enum">ColorRole</a>.</p>


<h3 class="fn"><a name="setColor" />QPalette.setColor (<i>self</i>, <a href="qpalette.html#ColorGroup-enum">ColorGroup</a>&#160;<i>acg</i>, <a href="qpalette.html#ColorRole-enum">ColorRole</a>&#160;<i>acr</i>, <a href="qcolor.html">QColor</a>&#160;<i>acolor</i>)</h3><p>Sets the color in the specified color <i>group</i>, used for the
given color <i>role</i>, to the specified solid <i>color</i>.</p>
<p><b>See also</b> <a href="qpalette.html#setBrush">setBrush</a>(),
<a href="qpalette.html#color">color</a>(), and <a href="qpalette.html#ColorRole-enum">ColorRole</a>.</p>


<h3 class="fn"><a name="setColor-2" />QPalette.setColor (<i>self</i>, <a href="qpalette.html#ColorRole-enum">ColorRole</a>&#160;<i>acr</i>, <a href="qcolor.html">QColor</a>&#160;<i>acolor</i>)</h3><p>This is an overloaded function.</p>
<p>Sets the color used for the given color <i>role</i>, in all
color groups, to the specified solid <i>color</i>.</p>
<p><b>See also</b> <a href="qpalette.html#brush">brush</a>(),
<a href="qpalette.html#setColor">setColor</a>(), and <a href="qpalette.html#ColorRole-enum">ColorRole</a>.</p>


<h3 class="fn"><a name="setColorGroup" />QPalette.setColorGroup (<i>self</i>, <a href="qpalette.html#ColorGroup-enum">ColorGroup</a>&#160;<i>cr</i>, <a href="qbrush.html">QBrush</a>&#160;<i>foreground</i>, <a href="qbrush.html">QBrush</a>&#160;<i>button</i>, <a href="qbrush.html">QBrush</a>&#160;<i>light</i>, <a href="qbrush.html">QBrush</a>&#160;<i>dark</i>, <a href="qbrush.html">QBrush</a>&#160;<i>mid</i>, <a href="qbrush.html">QBrush</a>&#160;<i>text</i>, <a href="qbrush.html">QBrush</a>&#160;<i>bright_text</i>, <a href="qbrush.html">QBrush</a>&#160;<i>base</i>, <a href="qbrush.html">QBrush</a>&#160;<i>background</i>)</h3><p>Sets a the group at <i>cg</i>. You can pass either brushes,
pixmaps or plain colors for <i>windowText</i>, <i>button</i>,
<i>light</i>, <i>dark</i>, <i>mid</i>, <i>text</i>,
<i>bright_text</i>, <i>base</i> and <i>window</i>.</p>
<p><b>See also</b> <a href="qbrush.html">QBrush</a>.</p>


<h3 class="fn"><a name="setCurrentColorGroup" />QPalette.setCurrentColorGroup (<i>self</i>, <a href="qpalette.html#ColorGroup-enum">ColorGroup</a>&#160;<i>cg</i>)</h3><p>Set the palette's current color group to <i>cg</i>.</p>
<p><b>See also</b> <a href="qpalette.html#currentColorGroup">currentColorGroup</a>().</p>


<h3 class="fn"><a name="shadow" /><a href="qbrush.html">QBrush</a> QPalette.shadow (<i>self</i>)</h3><p>Returns the shadow brush of the current color group.</p>
<p><b>See also</b> <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>


<h3 class="fn"><a name="text" /><a href="qbrush.html">QBrush</a> QPalette.text (<i>self</i>)</h3><p>Returns the text foreground brush of the current color
group.</p>
<p><b>See also</b> <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>


<h3 class="fn"><a name="toolTipBase" /><a href="qbrush.html">QBrush</a> QPalette.toolTipBase (<i>self</i>)</h3><p>Returns the tool tip base brush of the current color group. This
brush is used by <a href="qtooltip.html">QToolTip</a> and <a href="qwhatsthis.html">QWhatsThis</a>.</p>
<p><b>Note:</b> Tool tips use the Inactive color group of <a href="qpalette.html">QPalette</a>, because tool tips are not active
windows.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>


<h3 class="fn"><a name="toolTipText" /><a href="qbrush.html">QBrush</a> QPalette.toolTipText (<i>self</i>)</h3><p>Returns the tool tip text brush of the current color group. This
brush is used by <a href="qtooltip.html">QToolTip</a> and <a href="qwhatsthis.html">QWhatsThis</a>.</p>
<p><b>Note:</b> Tool tips use the Inactive color group of <a href="qpalette.html">QPalette</a>, because tool tips are not active
windows.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>


<h3 class="fn"><a name="window" /><a href="qbrush.html">QBrush</a> QPalette.window (<i>self</i>)</h3><p>Returns the window (general background) brush of the current
color group.</p>
<p><b>See also</b> <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>


<h3 class="fn"><a name="windowText" /><a href="qbrush.html">QBrush</a> QPalette.windowText (<i>self</i>)</h3><p>Returns the window text (general foreground) brush of the
current color group.</p>
<p><b>See also</b> <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>


<h3 class="fn"><a name="__eq__" />bool QPalette.__eq__ (<i>self</i>, <a href="qpalette.html">QPalette</a>&#160;<i>p</i>)</h3><h3 class="fn"><a name="__ne__" />bool QPalette.__ne__ (<i>self</i>, <a href="qpalette.html">QPalette</a>&#160;<i>p</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.12.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qt.io">The Qt Company</a> 2015</td><td align="right" width="25%">Qt&#160;4.8.7</td></tr></table></div></address></body></html>