~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/qpalette.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/gui/kernel/qpalette.cpp -->
 
6
<head>
 
7
    <title>Qt 4.0: QPalette Class Reference</title>
 
8
    <style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
 
9
a:link { color: #004faf; text-decoration: none }
 
10
a:visited { color: #672967; text-decoration: none }
 
11
td.postheader { font-family: sans-serif }
 
12
tr.address { font-family: sans-serif }
 
13
body { background: #ffffff; color: black; }</style>
 
14
</head>
 
15
<body>
 
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
17
<tr>
 
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
 
19
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
 
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QPalette Class Reference</h1>
 
21
<p>The QPalette class contains color groups for each widget state. <a href="#details">More...</a></p>
 
22
<pre>#include &lt;QPalette&gt;</pre><p>Part of the <a href="qtgui.html">QtGui</a> module.</p>
 
23
<p>Inherited by <a href="qcolorgroup.html">QColorGroup</a>.</p>
 
24
<ul>
 
25
<li><a href="qpalette-members.html">List of all members, including inherited members</a></li>
 
26
<li><a href="qpalette-obsolete.html">Obsolete members</a></li>
 
27
<li><a href="qpalette-qt3.html">Qt 3 support members</a></li>
 
28
</ul>
 
29
<a name="public-types"></a>
 
30
<h3>Public Types</h3>
 
31
<ul>
 
32
<li><div class="fn"/>enum <b><a href="qpalette.html#ColorGroup-enum">ColorGroup</a></b> { Disabled, Active, Inactive, Normal }</li>
 
33
<li><div class="fn"/>enum <b><a href="qpalette.html#ColorRole-enum">ColorRole</a></b> { Background, Foreground, Base, AlternateBase, ..., LinkVisited }</li>
 
34
</ul>
 
35
<a name="public-functions"></a>
 
36
<h3>Public Functions</h3>
 
37
<ul>
 
38
<li><div class="fn"/><b><a href="qpalette.html#QPalette">QPalette</a></b> ()</li>
 
39
<li><div class="fn"/><b><a href="qpalette.html#QPalette-2">QPalette</a></b> ( const QColor &amp; <i>button</i> )</li>
 
40
<li><div class="fn"/><b><a href="qpalette.html#QPalette-3">QPalette</a></b> ( Qt::GlobalColor <i>button</i> )</li>
 
41
<li><div class="fn"/><b><a href="qpalette.html#QPalette-4">QPalette</a></b> ( const QColor &amp; <i>button</i>, const QColor &amp; <i>background</i> )</li>
 
42
<li><div class="fn"/><b><a href="qpalette.html#QPalette-5">QPalette</a></b> ( const QBrush &amp; <i>foreground</i>, const QBrush &amp; <i>button</i>, const QBrush &amp; <i>light</i>, const QBrush &amp; <i>dark</i>, const QBrush &amp; <i>mid</i>, const QBrush &amp; <i>text</i>, const QBrush &amp; <i>bright_text</i>, const QBrush &amp; <i>base</i>, const QBrush &amp; <i>background</i> )</li>
 
43
<li><div class="fn"/><b><a href="qpalette.html#QPalette-8">QPalette</a></b> ( const QPalette &amp; <i>p</i> )</li>
 
44
<li><div class="fn"/><b><a href="qpalette.html#dtor.QPalette">~QPalette</a></b> ()</li>
 
45
<li><div class="fn"/>const QBrush &amp; <b><a href="qpalette.html#alternateBase">alternateBase</a></b> () const</li>
 
46
<li><div class="fn"/>const QBrush &amp; <b><a href="qpalette.html#background">background</a></b> () const</li>
 
47
<li><div class="fn"/>const QBrush &amp; <b><a href="qpalette.html#base">base</a></b> () const</li>
 
48
<li><div class="fn"/>const QBrush &amp; <b><a href="qpalette.html#brightText">brightText</a></b> () const</li>
 
49
<li><div class="fn"/>const QBrush &amp; <b><a href="qpalette.html#brush">brush</a></b> ( ColorGroup <i>gr</i>, ColorRole <i>cr</i> ) const</li>
 
50
<li><div class="fn"/>const QBrush &amp; <b><a href="qpalette.html#brush-2">brush</a></b> ( ColorRole <i>r</i> ) const</li>
 
51
<li><div class="fn"/>const QBrush &amp; <b><a href="qpalette.html#button">button</a></b> () const</li>
 
52
<li><div class="fn"/>const QBrush &amp; <b><a href="qpalette.html#buttonText">buttonText</a></b> () const</li>
 
53
<li><div class="fn"/>const QColor &amp; <b><a href="qpalette.html#color">color</a></b> ( ColorGroup <i>gr</i>, ColorRole <i>r</i> ) const</li>
 
54
<li><div class="fn"/>const QColor &amp; <b><a href="qpalette.html#color-2">color</a></b> ( ColorRole <i>r</i> ) const</li>
 
55
<li><div class="fn"/>ColorGroup <b><a href="qpalette.html#currentColorGroup">currentColorGroup</a></b> () const</li>
 
56
<li><div class="fn"/>const QBrush &amp; <b><a href="qpalette.html#dark">dark</a></b> () const</li>
 
57
<li><div class="fn"/>const QBrush &amp; <b><a href="qpalette.html#foreground">foreground</a></b> () const</li>
 
58
<li><div class="fn"/>const QBrush &amp; <b><a href="qpalette.html#highlight">highlight</a></b> () const</li>
 
59
<li><div class="fn"/>const QBrush &amp; <b><a href="qpalette.html#highlightedText">highlightedText</a></b> () const</li>
 
60
<li><div class="fn"/>bool <b><a href="qpalette.html#isCopyOf">isCopyOf</a></b> ( const QPalette &amp; <i>p</i> ) const</li>
 
61
<li><div class="fn"/>bool <b><a href="qpalette.html#isEqual">isEqual</a></b> ( ColorGroup <i>cg1</i>, ColorGroup <i>cg2</i> ) const</li>
 
62
<li><div class="fn"/>const QBrush &amp; <b><a href="qpalette.html#light">light</a></b> () const</li>
 
63
<li><div class="fn"/>const QBrush &amp; <b><a href="qpalette.html#link">link</a></b> () const</li>
 
64
<li><div class="fn"/>const QBrush &amp; <b><a href="qpalette.html#linkVisited">linkVisited</a></b> () const</li>
 
65
<li><div class="fn"/>const QBrush &amp; <b><a href="qpalette.html#mid">mid</a></b> () const</li>
 
66
<li><div class="fn"/>const QBrush &amp; <b><a href="qpalette.html#midlight">midlight</a></b> () const</li>
 
67
<li><div class="fn"/>QPalette <b><a href="qpalette.html#resolve">resolve</a></b> ( const QPalette &amp; <i>other</i> ) const</li>
 
68
<li><div class="fn"/>int <b><a href="qpalette.html#serialNumber">serialNumber</a></b> () const</li>
 
69
<li><div class="fn"/>void <b><a href="qpalette.html#setBrush">setBrush</a></b> ( ColorRole <i>cr</i>, const QBrush &amp; <i>brush</i> )</li>
 
70
<li><div class="fn"/>void <b><a href="qpalette.html#setBrush-2">setBrush</a></b> ( ColorGroup <i>cg</i>, ColorRole <i>cr</i>, const QBrush &amp; <i>b</i> )</li>
 
71
<li><div class="fn"/>void <b><a href="qpalette.html#setColor">setColor</a></b> ( ColorGroup <i>gr</i>, ColorRole <i>r</i>, const QColor &amp; <i>c</i> )</li>
 
72
<li><div class="fn"/>void <b><a href="qpalette.html#setColor-2">setColor</a></b> ( ColorRole <i>r</i>, const QColor &amp; <i>c</i> )</li>
 
73
<li><div class="fn"/>void <b><a href="qpalette.html#setColorGroup">setColorGroup</a></b> ( ColorGroup <i>cg</i>, const QBrush &amp; <i>foreground</i>, const QBrush &amp; <i>button</i>, const QBrush &amp; <i>light</i>, const QBrush &amp; <i>dark</i>, const QBrush &amp; <i>mid</i>, const QBrush &amp; <i>text</i>, const QBrush &amp; <i>bright_text</i>, const QBrush &amp; <i>base</i>, const QBrush &amp; <i>background</i> )</li>
 
74
<li><div class="fn"/>void <b><a href="qpalette.html#setCurrentColorGroup">setCurrentColorGroup</a></b> ( ColorGroup <i>cg</i> )</li>
 
75
<li><div class="fn"/>const QBrush &amp; <b><a href="qpalette.html#shadow">shadow</a></b> () const</li>
 
76
<li><div class="fn"/>const QBrush &amp; <b><a href="qpalette.html#text">text</a></b> () const</li>
 
77
<li><div class="fn"/><b><a href="qpalette.html#operator-QVariant">operator QVariant</a></b> () const</li>
 
78
<li><div class="fn"/>bool <b><a href="qpalette.html#operator-not-eq">operator!=</a></b> ( const QPalette &amp; <i>p</i> ) const</li>
 
79
<li><div class="fn"/>QPalette &amp; <b><a href="qpalette.html#operator-eq">operator=</a></b> ( const QPalette &amp; <i>p</i> )</li>
 
80
<li><div class="fn"/>bool <b><a href="qpalette.html#operator-eq-eq">operator==</a></b> ( const QPalette &amp; <i>p</i> ) const</li>
 
81
</ul>
 
82
<a name="related-non-members"></a>
 
83
<h3>Related Non-Members</h3>
 
84
<ul>
 
85
<li><div class="fn"/>QDataStream &amp; <b><a href="qpalette.html#operator-lt-lt-65">operator&lt;&lt;</a></b> ( QDataStream &amp; <i>s</i>, const QPalette &amp; <i>p</i> )</li>
 
86
<li><div class="fn"/>QDataStream &amp; <b><a href="qpalette.html#operator-gt-gt-45">operator&gt;&gt;</a></b> ( QDataStream &amp; <i>s</i>, QPalette &amp; <i>p</i> )</li>
 
87
</ul>
 
88
<a name="details"></a>
 
89
<hr />
 
90
<h2>Detailed Description</h2>
 
91
<p>The QPalette class contains color groups for each widget state.</p>
 
92
<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>
 
93
<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>
 
94
<p>The color groups:</p>
 
95
<ul>
 
96
<li>The Active group is used for the window that has keyboard focus.</li>
 
97
<li>The Inactive group is used for other windows.</li>
 
98
<li>The Disabled group is used for widgets (not windows) that are disabled for some reason.</li>
 
99
</ul>
 
100
<p>Both active and inactive windows can contain disabled widgets. (Disabled widgets are often called <i>inaccessible</i> or <i>grayed out</i>.)</p>
 
101
<p>In most styles, Active and Inactive look the same.</p>
 
102
<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 &quot;foreground&quot; and &quot;base&quot; rather than literal colors like &quot;red&quot; or &quot;turquoise&quot;. The color roles are enumerated and defined in the <a href="qpalette.html#ColorRole-enum">ColorRole</a> documentation.</p>
 
103
<p>We strongly recommend that you use a system-supplied color group and modify that as necessary.</p>
 
104
<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>
 
105
<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#background">background</a>(), <a href="qpalette.html#foreground">foreground</a>(), <a href="qpalette.html#base">base</a>(), etc.</p>
 
106
<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>
 
107
<p>QPalette is optimized by the use of <a href="shclass.html">implicit sharing</a>, so it is very efficient to pass QPalette objects as arguments.</p>
 
108
<p>See also <a href="qapplication.html#setPalette">QApplication::setPalette</a>(), <a href="qwidget.html#palette-prop">QWidget::setPalette</a>(), and <a href="qcolor.html">QColor</a>.</p>
 
109
<hr />
 
110
<h2>Member Type Documentation</h2>
 
111
<h3 class="fn"><a name="ColorGroup-enum"></a>enum QPalette::ColorGroup</h3>
 
112
<table border="1" cellpadding="2" cellspacing="1" width="100%">
 
113
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
 
114
<tr><td valign="top"><tt>QPalette::Disabled</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">&nbsp;</td></tr>
 
115
<tr><td valign="top"><tt>QPalette::Active</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">&nbsp;</td></tr>
 
116
<tr><td valign="top"><tt>QPalette::Inactive</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">&nbsp;</td></tr>
 
117
<tr><td valign="top"><tt>QPalette::Normal</tt></td><td align="center" valign="top"><tt>Active</tt></td><td valign="top">synonym for Active</td></tr>
 
118
</table>
 
119
<h3 class="fn"><a name="ColorRole-enum"></a>enum QPalette::ColorRole</h3>
 
120
<p>The ColorRole enum defines the different symbolic color roles used in current GUIs.</p>
 
121
<p>The central roles are:</p>
 
122
<table border="1" cellpadding="2" cellspacing="1" width="100%">
 
123
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
 
124
<tr><td valign="top"><tt>QPalette::Background</tt></td><td align="center" valign="top"><tt>10</tt></td><td valign="top">A general background color.</td></tr>
 
125
<tr><td valign="top"><tt>QPalette::Foreground</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">A general foreground color.</td></tr>
 
126
<tr><td valign="top"><tt>QPalette::Base</tt></td><td align="center" valign="top"><tt>9</tt></td><td valign="top">Used as the background color for text entry widgets; usually white or another light color.</td></tr>
 
127
<tr><td valign="top"><tt>QPalette::AlternateBase</tt></td><td align="center" valign="top"><tt>16</tt></td><td valign="top">Used as the alternate background color in views with alternating row colors (see <a href="qabstractitemview.html#alternatingRowColors-prop">QAbstractItemView::setAlternatingRowColors</a>()).</td></tr>
 
128
<tr><td valign="top"><tt>QPalette::Text</tt></td><td align="center" valign="top"><tt>6</tt></td><td valign="top">The foreground color used with <tt>Base</tt>. This is usually the same as the <tt>Foreground</tt>, in which case it must provide good contrast with <tt>Background</tt> and <tt>Base</tt>.</td></tr>
 
129
<tr><td valign="top"><tt>QPalette::Button</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">The general button background color. This background can be different from <tt>Background</tt> as some styles require a different background color for buttons.</td></tr>
 
130
<tr><td valign="top"><tt>QPalette::ButtonText</tt></td><td align="center" valign="top"><tt>8</tt></td><td valign="top">A foreground color used with the <tt>Button</tt> color.</td></tr>
 
131
</table>
 
132
<p>There are some color roles used mostly for 3D bevel and shadow effects. All of these are normally derived from <tt>Background</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>Background</tt>.</p>
 
133
<table border="1" cellpadding="2" cellspacing="1" width="100%">
 
134
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
 
135
<tr><td valign="top"><tt>QPalette::Light</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">Lighter than <tt>Button</tt> color.</td></tr>
 
136
<tr><td valign="top"><tt>QPalette::Midlight</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">Between <tt>Button</tt> and <tt>Light</tt>.</td></tr>
 
137
<tr><td valign="top"><tt>QPalette::Dark</tt></td><td align="center" valign="top"><tt>4</tt></td><td valign="top">Darker than <tt>Button</tt>.</td></tr>
 
138
<tr><td valign="top"><tt>QPalette::Mid</tt></td><td align="center" valign="top"><tt>5</tt></td><td valign="top">Between <tt>Button</tt> and <tt>Dark</tt>.</td></tr>
 
139
<tr><td valign="top"><tt>QPalette::Shadow</tt></td><td align="center" valign="top"><tt>11</tt></td><td valign="top">A very dark color. By default, the shadow color is <tt>Qt::black</tt>.</td></tr>
 
140
</table>
 
141
<p>Selected (marked) items have two roles:</p>
 
142
<table border="1" cellpadding="2" cellspacing="1" width="100%">
 
143
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
 
144
<tr><td valign="top"><tt>QPalette::Highlight</tt></td><td align="center" valign="top"><tt>12</tt></td><td valign="top">A color to indicate a selected item or the current item. By default, the highlight color is <tt>Qt::darkBlue</tt>.</td></tr>
 
145
<tr><td valign="top"><tt>QPalette::HighlightedText</tt></td><td align="center" valign="top"><tt>13</tt></td><td valign="top">A text color that contrasts with <tt>Highlight</tt>. By default, the highlighted text color is <tt>Qt::white</tt>.</td></tr>
 
146
</table>
 
147
<p>Finally, there is a special role for text that needs to be drawn where <tt>Text</tt> or <tt>Foreground</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.</p>
 
148
<table border="1" cellpadding="2" cellspacing="1" width="100%">
 
149
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
 
150
<tr><td valign="top"><tt>QPalette::BrightText</tt></td><td align="center" valign="top"><tt>7</tt></td><td valign="top">A text color that is very different from <tt>Foreground</tt>, and contrasts well with e.g. <tt>Dark</tt>.</td></tr>
 
151
<tr><td valign="top"><tt>QPalette::Link</tt></td><td align="center" valign="top"><tt>14</tt></td><td valign="top">A text color used for unvisited hyperlinks. By default, the link color is <tt>Qt::blue</tt>.</td></tr>
 
152
<tr><td valign="top"><tt>QPalette::LinkVisited</tt></td><td align="center" valign="top"><tt>15</tt></td><td valign="top">A text color used for already visited hyperlinks. By default, the linkvisited color is <tt>Qt::magenta</tt>.</td></tr>
 
153
</table>
 
154
<p>This image shows most of the color roles in use: <center><img src="images/palette.png" alt="Color Roles" /></center></p>
 
155
<hr />
 
156
<h2>Member Function Documentation</h2>
 
157
<h3 class="fn"><a name="QPalette"></a>QPalette::QPalette ()</h3>
 
158
<p>Constructs a palette object that uses the application's default palette.</p>
 
159
<p>See also <a href="qapplication.html#setPalette">QApplication::setPalette</a>() and <a href="qapplication.html#palette">QApplication::palette</a>().</p>
 
160
<h3 class="fn"><a name="QPalette-2"></a>QPalette::QPalette ( const <a href="qcolor.html">QColor</a> &amp; <i>button</i> )</h3>
 
161
<p>Constructs a palette from the <i>button</i> color. The other colors are automatically calculated, based on this color. Background will be the button color as well.</p>
 
162
<h3 class="fn"><a name="QPalette-3"></a>QPalette::QPalette ( <a href="qt.html#GlobalColor-enum">Qt::GlobalColor</a> <i>button</i> )</h3>
 
163
<p>Constructs a palette from the <i>button</i> color. The other colors are automatically calculated, based on this color. Background will be the button color as well.</p>
 
164
<h3 class="fn"><a name="QPalette-4"></a>QPalette::QPalette ( const <a href="qcolor.html">QColor</a> &amp; <i>button</i>, const <a href="qcolor.html">QColor</a> &amp; <i>background</i> )</h3>
 
165
<p>Constructs a palette from a <i>button</i> color and a <i>background</i>. The other colors are automatically calculated, based on these colors.</p>
 
166
<h3 class="fn"><a name="QPalette-5"></a>QPalette::QPalette ( const <a href="qbrush.html">QBrush</a> &amp; <i>foreground</i>, const <a href="qbrush.html">QBrush</a> &amp; <i>button</i>, const <a href="qbrush.html">QBrush</a> &amp; <i>light</i>, const <a href="qbrush.html">QBrush</a> &amp; <i>dark</i>, const <a href="qbrush.html">QBrush</a> &amp; <i>mid</i>, const <a href="qbrush.html">QBrush</a> &amp; <i>text</i>, const <a href="qbrush.html">QBrush</a> &amp; <i>bright_text</i>, const <a href="qbrush.html">QBrush</a> &amp; <i>base</i>, const <a href="qbrush.html">QBrush</a> &amp; <i>background</i> )</h3>
 
167
<p>Constructs a palette. You can pass either brushes, pixmaps or plain colors for <i>foreground</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>background</i>.</p>
 
168
<p>See also <a href="qbrush.html">QBrush</a>.</p>
 
169
<h3 class="fn"><a name="QPalette-8"></a>QPalette::QPalette ( const QPalette &amp; <i>p</i> )</h3>
 
170
<p>Constructs a copy of <i>p</i>.</p>
 
171
<p>This constructor is fast because of <a href="shclass.html">implicit sharing</a>.</p>
 
172
<h3 class="fn"><a name="dtor.QPalette"></a>QPalette::~QPalette ()</h3>
 
173
<p>Destroys the palette.</p>
 
174
<h3 class="fn"><a name="alternateBase"></a>const <a href="qbrush.html">QBrush</a> &amp; QPalette::alternateBase () const</h3>
 
175
<p>Returns the alternate base brush of the current color group.</p>
 
176
<p>See also <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>
 
177
<h3 class="fn"><a name="background"></a>const <a href="qbrush.html">QBrush</a> &amp; QPalette::background () const</h3>
 
178
<p>Returns the background brush of the current color group.</p>
 
179
<p>See also <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>
 
180
<h3 class="fn"><a name="base"></a>const <a href="qbrush.html">QBrush</a> &amp; QPalette::base () const</h3>
 
181
<p>Returns the base brush of the current color group.</p>
 
182
<p>See also <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>
 
183
<h3 class="fn"><a name="brightText"></a>const <a href="qbrush.html">QBrush</a> &amp; QPalette::brightText () const</h3>
 
184
<p>Returns the bright text foreground brush of the current color group.</p>
 
185
<p>See also <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>
 
186
<h3 class="fn"><a name="brush"></a>const <a href="qbrush.html">QBrush</a> &amp; QPalette::brush ( <a href="qpalette.html#ColorGroup-enum">ColorGroup</a> <i>gr</i>, <a href="qpalette.html#ColorRole-enum">ColorRole</a> <i>cr</i> ) const</h3>
 
187
<p>Returns the brush in color group <i>gr</i>, used for color role <i>cr</i>.</p>
 
188
<p>See also <a href="qpalette.html#color">color</a>(), <a href="qpalette.html#setBrush">setBrush</a>(), and <a href="qpalette.html#ColorRole-enum">ColorRole</a>.</p>
 
189
<h3 class="fn"><a name="brush-2"></a>const <a href="qbrush.html">QBrush</a> &amp; QPalette::brush ( <a href="qpalette.html#ColorRole-enum">ColorRole</a> <i>r</i> ) const</h3>
 
190
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
191
<p>Returns the brush that has been set for color role <i>r</i> in the current <a href="qpalette.html#ColorGroup-enum">ColorGroup</a>.</p>
 
192
<p>See also <a href="qpalette.html#color">color</a>(), <a href="qpalette.html#setBrush">setBrush</a>(), and <a href="qpalette.html#ColorRole-enum">ColorRole</a>.</p>
 
193
<h3 class="fn"><a name="button"></a>const <a href="qbrush.html">QBrush</a> &amp; QPalette::button () const</h3>
 
194
<p>Returns the button brush of the current color group.</p>
 
195
<p>See also <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>
 
196
<h3 class="fn"><a name="buttonText"></a>const <a href="qbrush.html">QBrush</a> &amp; QPalette::buttonText () const</h3>
 
197
<p>Returns the button text foreground brush of the current color group.</p>
 
198
<p>See also <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>
 
199
<h3 class="fn"><a name="color"></a>const <a href="qcolor.html">QColor</a> &amp; QPalette::color ( <a href="qpalette.html#ColorGroup-enum">ColorGroup</a> <i>gr</i>, <a href="qpalette.html#ColorRole-enum">ColorRole</a> <i>r</i> ) const</h3>
 
200
<p>Returns the color in color group <i>gr</i>, used for color role <i>r</i>.</p>
 
201
<p>See also <a href="qpalette.html#brush">brush</a>(), <a href="qpalette.html#setColor">setColor</a>(), and <a href="qpalette.html#ColorRole-enum">ColorRole</a>.</p>
 
202
<h3 class="fn"><a name="color-2"></a>const <a href="qcolor.html">QColor</a> &amp; QPalette::color ( <a href="qpalette.html#ColorRole-enum">ColorRole</a> <i>r</i> ) const</h3>
 
203
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
204
<p>Returns the color that has been set for color role <i>r</i> in the current <a href="qpalette.html#ColorGroup-enum">ColorGroup</a>.</p>
 
205
<p>See also <a href="qpalette.html#brush">brush</a>() and <a href="qpalette.html#ColorRole-enum">ColorRole</a>.</p>
 
206
<h3 class="fn"><a name="currentColorGroup"></a><a href="qpalette.html#ColorGroup-enum">ColorGroup</a> QPalette::currentColorGroup () const</h3>
 
207
<p>Returns the palette's current color group.</p>
 
208
<h3 class="fn"><a name="dark"></a>const <a href="qbrush.html">QBrush</a> &amp; QPalette::dark () const</h3>
 
209
<p>Returns the dark brush of the current color group.</p>
 
210
<p>See also <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>
 
211
<h3 class="fn"><a name="foreground"></a>const <a href="qbrush.html">QBrush</a> &amp; QPalette::foreground () const</h3>
 
212
<p>Returns the foreground brush of the current color group.</p>
 
213
<p>See also <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>
 
214
<h3 class="fn"><a name="highlight"></a>const <a href="qbrush.html">QBrush</a> &amp; QPalette::highlight () const</h3>
 
215
<p>Returns the highlight brush of the current color group.</p>
 
216
<p>See also <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>
 
217
<h3 class="fn"><a name="highlightedText"></a>const <a href="qbrush.html">QBrush</a> &amp; QPalette::highlightedText () const</h3>
 
218
<p>Returns the highlighted text brush of the current color group.</p>
 
219
<p>See also <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>
 
220
<h3 class="fn"><a name="isCopyOf"></a>bool QPalette::isCopyOf ( const QPalette &amp; <i>p</i> ) const</h3>
 
221
<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>
 
222
<p>See also <a href="qpalette.html#operator-eq">operator=</a>() and <a href="qpalette.html#operator-eq-eq">operator==</a>().</p>
 
223
<h3 class="fn"><a name="isEqual"></a>bool QPalette::isEqual ( <a href="qpalette.html#ColorGroup-enum">ColorGroup</a> <i>cg1</i>, <a href="qpalette.html#ColorGroup-enum">ColorGroup</a> <i>cg2</i> ) const</h3>
 
224
<p>Returns true (usually quickly) if color group <i>cg1</i> is equal to <i>cg2</i>; otherwise returns false.</p>
 
225
<h3 class="fn"><a name="light"></a>const <a href="qbrush.html">QBrush</a> &amp; QPalette::light () const</h3>
 
226
<p>Returns the light brush of the current color group.</p>
 
227
<p>See also <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>
 
228
<h3 class="fn"><a name="link"></a>const <a href="qbrush.html">QBrush</a> &amp; QPalette::link () const</h3>
 
229
<p>Returns the unvisited link text brush of the current color group.</p>
 
230
<p>See also <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>
 
231
<h3 class="fn"><a name="linkVisited"></a>const <a href="qbrush.html">QBrush</a> &amp; QPalette::linkVisited () const</h3>
 
232
<p>Returns the visited link text brush of the current color group.</p>
 
233
<p>See also <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>
 
234
<h3 class="fn"><a name="mid"></a>const <a href="qbrush.html">QBrush</a> &amp; QPalette::mid () const</h3>
 
235
<p>Returns the mid brush of the current color group.</p>
 
236
<p>See also <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>
 
237
<h3 class="fn"><a name="midlight"></a>const <a href="qbrush.html">QBrush</a> &amp; QPalette::midlight () const</h3>
 
238
<p>Returns the midlight brush of the current color group.</p>
 
239
<p>See also <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>
 
240
<h3 class="fn"><a name="resolve"></a>QPalette QPalette::resolve ( const QPalette &amp; <i>other</i> ) const</h3>
 
241
<p>Returns a new <a href="qpalette.html">QPalette</a> that has attributes copied from <i>other</i>.</p>
 
242
<h3 class="fn"><a name="serialNumber"></a>int QPalette::serialNumber () const</h3>
 
243
<p>Returns a number that uniquely identifies this <a href="qpalette.html">QPalette</a> object. The serial number is intended for caching. Its value may not be used for anything other than equality testing.</p>
 
244
<p>Note that <a href="qpalette.html">QPalette</a> uses implicit sharing, and the serial number changes during the lazy copy operation (when the palette is actually modified), not during a shallow copy (copy constructor or assignment).</p>
 
245
<p>See also <a href="qpixmap.html">QPixmap</a>, <a href="qpixmapcache.html">QPixmapCache</a>, and <a href="qcache.html">QCache</a>.</p>
 
246
<h3 class="fn"><a name="setBrush"></a>void QPalette::setBrush ( <a href="qpalette.html#ColorRole-enum">ColorRole</a> <i>cr</i>, const <a href="qbrush.html">QBrush</a> &amp; <i>brush</i> )</h3>
 
247
<p>Sets the brush used to color role <i>cr</i> and brush <i>brush</i>.</p>
 
248
<p>See also <a href="qpalette.html#brush">brush</a>(), <a href="qpalette.html#setColor">setColor</a>(), and <a href="qpalette.html#ColorRole-enum">ColorRole</a>.</p>
 
249
<h3 class="fn"><a name="setBrush-2"></a>void QPalette::setBrush ( <a href="qpalette.html#ColorGroup-enum">ColorGroup</a> <i>cg</i>, <a href="qpalette.html#ColorRole-enum">ColorRole</a> <i>cr</i>, const <a href="qbrush.html">QBrush</a> &amp; <i>b</i> )</h3>
 
250
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
251
<p>Sets the brush in color group <i>cg</i>, used for color role <i>cr</i>, to <i>b</i>.</p>
 
252
<p>See also <a href="qpalette.html#brush">brush</a>(), <a href="qpalette.html#setColor">setColor</a>(), and <a href="qpalette.html#ColorRole-enum">ColorRole</a>.</p>
 
253
<h3 class="fn"><a name="setColor"></a>void QPalette::setColor ( <a href="qpalette.html#ColorGroup-enum">ColorGroup</a> <i>gr</i>, <a href="qpalette.html#ColorRole-enum">ColorRole</a> <i>r</i>, const <a href="qcolor.html">QColor</a> &amp; <i>c</i> )</h3>
 
254
<p>Sets the brush in color group <i>gr</i>, used for color role <i>r</i>, to the solid color <i>c</i>.</p>
 
255
<p>See also <a href="qpalette.html#setBrush">setBrush</a>(), <a href="qpalette.html#color">color</a>(), and <a href="qpalette.html#ColorRole-enum">ColorRole</a>.</p>
 
256
<h3 class="fn"><a name="setColor-2"></a>void QPalette::setColor ( <a href="qpalette.html#ColorRole-enum">ColorRole</a> <i>r</i>, const <a href="qcolor.html">QColor</a> &amp; <i>c</i> )</h3>
 
257
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
258
<p>Sets the brush used for color role <i>r</i> in the current <a href="qpalette.html#ColorGroup-enum">ColorGroup</a> to a solid color <i>c</i>.</p>
 
259
<p>See also <a href="qpalette.html#brush">brush</a>(), <a href="qpalette.html#setColor">setColor</a>(), and <a href="qpalette.html#ColorRole-enum">ColorRole</a>.</p>
 
260
<h3 class="fn"><a name="setColorGroup"></a>void QPalette::setColorGroup ( <a href="qpalette.html#ColorGroup-enum">ColorGroup</a> <i>cg</i>, const <a href="qbrush.html">QBrush</a> &amp; <i>foreground</i>, const <a href="qbrush.html">QBrush</a> &amp; <i>button</i>, const <a href="qbrush.html">QBrush</a> &amp; <i>light</i>, const <a href="qbrush.html">QBrush</a> &amp; <i>dark</i>, const <a href="qbrush.html">QBrush</a> &amp; <i>mid</i>, const <a href="qbrush.html">QBrush</a> &amp; <i>text</i>, const <a href="qbrush.html">QBrush</a> &amp; <i>bright_text</i>, const <a href="qbrush.html">QBrush</a> &amp; <i>base</i>, const <a href="qbrush.html">QBrush</a> &amp; <i>background</i> )</h3>
 
261
<p>Sets a the group at <i>cg</i>. You can pass either brushes, pixmaps or plain colors for <i>foreground</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>background</i>.</p>
 
262
<p>See also <a href="qbrush.html">QBrush</a>.</p>
 
263
<h3 class="fn"><a name="setCurrentColorGroup"></a>void QPalette::setCurrentColorGroup ( <a href="qpalette.html#ColorGroup-enum">ColorGroup</a> <i>cg</i> )</h3>
 
264
<p>Set the palette's current color group to <i>cg</i>.</p>
 
265
<h3 class="fn"><a name="shadow"></a>const <a href="qbrush.html">QBrush</a> &amp; QPalette::shadow () const</h3>
 
266
<p>Returns the shadow brush of the current color group.</p>
 
267
<p>See also <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>
 
268
<h3 class="fn"><a name="text"></a>const <a href="qbrush.html">QBrush</a> &amp; QPalette::text () const</h3>
 
269
<p>Returns the text foreground brush of the current color group.</p>
 
270
<p>See also <a href="qpalette.html#ColorRole-enum">ColorRole</a> and <a href="qpalette.html#brush">brush</a>().</p>
 
271
<h3 class="fn"><a name="operator-QVariant"></a>QPalette::operator QVariant () const</h3>
 
272
<p>Returns the palette as a <a href="qvariant.html">QVariant</a></p>
 
273
<h3 class="fn"><a name="operator-not-eq"></a>bool QPalette::operator!= ( const QPalette &amp; <i>p</i> ) const</h3>
 
274
<p>Returns true (slowly) if this palette is different from <i>p</i>; otherwise returns false (usually quickly).</p>
 
275
<h3 class="fn"><a name="operator-eq"></a>QPalette &amp; QPalette::operator= ( const QPalette &amp; <i>p</i> )</h3>
 
276
<p>Assigns <i>p</i> to this palette and returns a reference to this palette.</p>
 
277
<p>This operation is fast because of <a href="shclass.html">implicit sharing</a>.</p>
 
278
<h3 class="fn"><a name="operator-eq-eq"></a>bool QPalette::operator== ( const QPalette &amp; <i>p</i> ) const</h3>
 
279
<p>Returns true (usually quickly) if this palette is equal to <i>p</i>; otherwise returns false (slowly).</p>
 
280
<hr />
 
281
<h2>Related Non-Members</h2>
 
282
<h3 class="fn"><a name="operator-lt-lt-65"></a><a href="qdatastream.html">QDataStream</a> &amp; operator&lt;&lt; ( <a href="qdatastream.html">QDataStream</a> &amp; <i>s</i>, const QPalette &amp; <i>p</i> )</h3>
 
283
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
284
<p>Writes the palette, <i>p</i> to the stream <i>s</i> and returns a reference to the stream.</p>
 
285
<p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.</p>
 
286
<h3 class="fn"><a name="operator-gt-gt-45"></a><a href="qdatastream.html">QDataStream</a> &amp; operator&gt;&gt; ( <a href="qdatastream.html">QDataStream</a> &amp; <i>s</i>, QPalette &amp; <i>p</i> )</h3>
 
287
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
288
<p>Reads a palette from the stream, <i>s</i> into the palette <i>p</i>, and returns a reference to the stream.</p>
 
289
<p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.</p>
 
290
<p /><address><hr /><div align="center">
 
291
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
292
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
293
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
294
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
295
</tr></table></div></address></body>
 
296
</html>