| 12
 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
 
 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QPalette Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QPalette Class Reference</h1><br clear="all">
<p>
The QPalette class contains color groups for each widget state.
<a href="#details">More...</a>
<p>
<code>#include <<a href="qpalette-h.html">qpalette.h</a>></code>
<p><a href="qpalette-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#4db7ec"><b>QPalette</b></a>()</div>
<li><div class="fn">QPalette(constQColor&button)<em>(obsolete)</em></div>
<li><div class="fn"><a href="#dcc4f5"><b>QPalette</b></a>(constQColor&button, constQColor&background)</div>
<li><div class="fn"><a href="#22730f"><b>QPalette</b></a>(constQColorGroup&active, constQColorGroup&disabled, constQColorGroup&inactive)</div>
<li><div class="fn"><a href="#e14c24"><b>QPalette</b></a>(constQPalette&)</div>
<li><div class="fn"><a href="#c079c6"><b>~QPalette</b></a>()</div>
<li><div class="fn">QPalette&<a href="#45beba"><b>operator=</b></a>(constQPalette&)</div>
<li><div class="fn">enum<b>ColorGroup</b>{Normal, Disabled, Active, Inactive, NColorGroups}</div>
<li><div class="fn">constQColor&<a href="#acc79b"><b>color</b></a>(ColorGroup, QColorGroup::ColorRole)const</div>
<li><div class="fn">constQBrush&<a href="#12851f"><b>brush</b></a>(ColorGroup, QColorGroup::ColorRole)const</div>
<li><div class="fn">void<a href="#7981c8"><b>setColor</b></a>(ColorGroup, QColorGroup::ColorRole, constQColor&)</div>
<li><div class="fn">void<a href="#e7f2bc"><b>setBrush</b></a>(ColorGroup, QColorGroup::ColorRole, constQBrush&)</div>
<li><div class="fn">void<a href="#4dd621"><b>setColor</b></a>(QColorGroup::ColorRole, constQColor&)</div>
<li><div class="fn">void<a href="#d95c94"><b>setBrush</b></a>(QColorGroup::ColorRole, constQBrush&)</div>
<li><div class="fn">QPalette<a href="#6f2662"><b>copy</b></a>()const</div>
<li><div class="fn">constQColorGroup&<a href="#73a182"><b>active</b></a>()const</div>
<li><div class="fn">constQColorGroup&<a href="#a67ec0"><b>disabled</b></a>()const</div>
<li><div class="fn">constQColorGroup&<a href="#7c5c7e"><b>inactive</b></a>()const</div>
<li><div class="fn">constQColorGroup&normal()const<em>(obsolete)</em></div>
<li><div class="fn">void<a href="#ef09be"><b>setActive</b></a>(constQColorGroup&)</div>
<li><div class="fn">void<a href="#be00a5"><b>setDisabled</b></a>(constQColorGroup&)</div>
<li><div class="fn">void<a href="#497f86"><b>setInactive</b></a>(constQColorGroup&)</div>
<li><div class="fn">voidsetNormal(constQColorGroup&)<em>(obsolete)</em></div>
<li><div class="fn">bool<a href="#0f9ec6"><b>operator==</b></a>(constQPalette&p)const</div>
<li><div class="fn">bool<a href="#420126"><b>operator!=</b></a>(constQPalette&p)const</div>
<li><div class="fn">bool<a href="#abb7ba"><b>isCopyOf</b></a>(constQPalette&)</div>
<li><div class="fn">int<a href="#1f3095"><b>serialNumber</b></a>()const</div>
</ul>
<h2>Related Functions</h2>
(Note that these are not member functions.)
<ul>
<li>QDataStream & <a href="qpalette.html#3613b9"><b>operator>></b></a> (QDataStream & s, QPalette & p)
<li>QDataStream & <a href="qpalette.html#69e1d9"><b>operator<<</b></a> (QDataStream & s, const QPalette & p)
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QPalette class contains color groups for each widget state.
<p>
A palette consists of three color groups: a <em>active,</em> a <em>disabled</em>
and an <em>inactive</em> color group.  All widgets contain a palette, and
all the widgets in Qt use their palette to draw themselves.  This
makes the user interface consistent and easily configurable.
<p>If you make a new widget you are strongly advised to use the colors in
the palette rather than hard-coding specific colors.
<p>The color groups are: <ul> <li> The <a href="#73a182">active</a>() group is used for the
window that has keyboard focus. <li> The <a href="#7c5c7e">inactive</a>() group is used
for other windows. <li> The <a href="#a67ec0">disabled</a>() group is used for widgets
(not windows) that are disabled for some reason. </ul>
<p>Of course, both active and inactive windows can contain disabled
widgets.  (Disabled widgets are often called <em>inaccessible</em> or <em>grayed out.)</em>
<p>In Motif style, active() and inactive() look precisely the same.  In
Windows 2000 style and Macintosh Platinum style, the two styles look
slightly different.
<p>There are <a href="#ef09be">setActive</a>(), <a href="#497f86">setInactive</a>() and <a href="#be00a5">setDisabled</a>() functions to
modify the palette.  Qt also supports a <a href="#d02d46">normal</a>() group; this is an
obsolete alias for active(), supported for backward compatibility.
<p>(The split between normal() and active() prior to Qt 2.1 did not
work except in the simplest of cases, hence the change to the
current, more powerful design.)
<p>See also  <a href="qapplication.html#9604e2">QApplication::setPalette</a>(), <a href="qwidget.html#379ca0">QWidget::setPalette</a>(), <a href="qcolorgroup.html">QColorGroup</a> and <a href="qcolor.html">QColor</a>.
<p>Examples:
 <a href="i18n-main-cpp.html#QPalette">i18n/main.cpp</a>
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="4db7ec"></a>QPalette::QPalette()</h3>
<p>Constructs a palette that consists of color groups with only black colors.
<h3 class="fn"><a name="6ab1b1"></a>QPalette::QPalette(const<a href="qcolor.html">QColor</a>&button)</h3>
<p><b>This function is obsolete.</b> It is provided to keep old source working, and will probably be removed in a future version of Qt.  We strongly advise against using it in new code.<p>
Constructs a palette from the <em>button</em> color. The other colors are
automatically calculated, based on this color. Background will be
the button color as well.
<h3 class="fn"><a name="dcc4f5"></a>QPalette::QPalette(const<a href="qcolor.html">QColor</a>&button, const<a href="qcolor.html">QColor</a>&background)</h3>
<p>Constructs a palette from a <em>button</em> color and a background. The other colors are
automatically calculated, based on these colors.
<h3 class="fn"><a name="22730f"></a>QPalette::QPalette(const<a href="qcolorgroup.html">QColorGroup</a>&active, const<a href="qcolorgroup.html">QColorGroup</a>&disabled, const<a href="qcolorgroup.html">QColorGroup</a>&inactive)</h3>
<p>Constructs a palette that consists of the three color groups <em>active, disabled</em> and <em>inactive.</em>  See QPalette for definitions
of the color groups and <a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a> for definitions of
each color role in the three groups.
<p>See also  <a href="qcolorgroup.html">QColorGroup</a>, <a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a> and <a href="qpalette.html">QPalette</a>.
<h3 class="fn"><a name="e14c24"></a>QPalette::QPalette(constQPalette&p)</h3>
<p>Constructs a copy of <em>p.</em>
<p>This constructor is fast (it uses copy-on-write).
<h3 class="fn"><a name="c079c6"></a>QPalette::~QPalette()</h3>
<p>Destructs the palette.
<h3 class="fn">const<a href="qcolorgroup.html">QColorGroup</a>&<a name="73a182"></a>QPalette::active()const</h3>
<p>Returns the active color group of this palette.
<p>See also  <a href="qcolorgroup.html">QColorGroup</a>, <a href="#ef09be">setActive</a>(), <a href="#7c5c7e">inactive</a>() and <a href="#a67ec0">disabled</a>().
<h3 class="fn">const<a href="qbrush.html">QBrush</a>&<a name="12851f"></a>QPalette::brush(ColorGroupgr, <a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a>r)const</h3>
<p>Returns the brush in <em>gr</em> used for color role <em>r.</em>
<p>See also  <a href="#acc79b">color</a>(), <a href="#d95c94">setBrush</a>() and <a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a>.
<h3 class="fn">const<a href="qcolor.html">QColor</a>&<a name="acc79b"></a>QPalette::color(ColorGroupgr, <a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a>r)const</h3>
<p>Returns the color in <em>gr</em> used for color role <em>r.</em>
<p>See also  <a href="#12851f">brush</a>(), <a href="#4dd621">setColor</a>() and <a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a>.
<h3 class="fn">QPalette<a name="6f2662"></a>QPalette::copy()const</h3>
<p>Return a deep copy of this palette.  This is slower than the copy
constructor and assignment operator and offers no advantages any more.
<h3 class="fn">const<a href="qcolorgroup.html">QColorGroup</a>&<a name="a67ec0"></a>QPalette::disabled()const</h3>
<p>Returns the disabled color group of this palette.
<p>See also  <a href="qcolorgroup.html">QColorGroup</a>, <a href="#be00a5">setDisabled</a>(), <a href="#73a182">active</a>() and <a href="#7c5c7e">inactive</a>().
<h3 class="fn">const<a href="qcolorgroup.html">QColorGroup</a>&<a name="7c5c7e"></a>QPalette::inactive()const</h3>
<p>Returns the inactive color group of this palette.
<p>See also  <a href="qcolorgroup.html">QColorGroup</a>, <a href="#497f86">setInactive</a>(), <a href="#73a182">active</a>() and <a href="#a67ec0">disabled</a>().
<h3 class="fn">bool<a name="abb7ba"></a>QPalette::isCopyOf(constQPalette&p)</h3>
<p>Returns TRUE if this palette and <em>p</em> are copies of each other,
ie. one of them was created as a copy of the other and neither was
subsequently modified.  This is much stricter than equality.
<p>See also  operator= and operator==.
<h3 class="fn">const<a href="qcolorgroup.html">QColorGroup</a>&<a name="d02d46"></a>QPalette::normal()const</h3>
<p><b>This function is obsolete.</b> It is provided to keep old source working, and will probably be removed in a future version of Qt.  We strongly advise against using it in new code.<p>
<p>Use <a href="#73a182">active</a>() instead.
<h3 class="fn">bool<a name="420126"></a>QPalette::operator!=(constQPalette&p)const</h3>
<p>Returns TRUE (slowly) if this palette is different from <em>p,</em> or
FALSE (usually quickly) if they are equal.
<h3 class="fn">QPalette&<a name="45beba"></a>QPalette::operator=(constQPalette&p)</h3>
<p>Assigns <em>p</em> to this palette and returns a reference to this
palette.
<p>This is fast (it uses copy-on-write).
<p>See also  <a href="#6f2662">copy</a>().
<h3 class="fn">bool<a name="0f9ec6"></a>QPalette::operator==(constQPalette&p)const</h3>
<p>Returns TRUE (usually quickly) if this palette is equal to <em>p,</em>
or FALSE (slowly) if they are different.
<h3 class="fn">int<a name="1f3095"></a>QPalette::serialNumber()const</h3>
<p>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.
<p>Note that QPalette uses copy-on-write, and the serial number changes
during the lazy copy operation (<a href="#653733">detach</a>()), not during a shallow
copy (copy constructor or assignment).
<p>See also  <a href="qpixmap.html">QPixmap</a>, <a href="qpixmapcache.html">QPixmapCache</a> and <a href="qcache.html">QCache</a>.
<h3 class="fn">void<a name="ef09be"></a>QPalette::setActive(const<a href="qcolorgroup.html">QColorGroup</a>&g)</h3>
<p>Sets the <code>Active</code> color group to <em>g.</em>
<p>See also  <a href="#73a182">active</a>(), <a href="#be00a5">setDisabled</a>(), <a href="#497f86">setInactive</a>() and <a href="qcolorgroup.html">QColorGroup</a>.
<h3 class="fn">void<a name="d95c94"></a>QPalette::setBrush(<a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a>r, const<a href="qbrush.html">QBrush</a>&b)</h3>
<p>Sets the brush in for color role <em>r</em> in all three color groups to <em>b.</em>
<p>See also  <a href="#12851f">brush</a>(), <a href="#4dd621">setColor</a>(), <a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a>, <a href="#73a182">active</a>(), <a href="#7c5c7e">inactive</a>() and <a href="#a67ec0">disabled</a>().
<h3 class="fn">void<a name="e7f2bc"></a>QPalette::setBrush(ColorGroupgr, <a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a>r, const<a href="qbrush.html">QBrush</a>&b)</h3>
<p>Sets the brush in <em>gr</em> used for color role <em>r</em> to <em>b.</em>
<p>See also  <a href="#12851f">brush</a>(), <a href="#4dd621">setColor</a>() and <a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a>.
<h3 class="fn">void<a name="4dd621"></a>QPalette::setColor(<a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a>r, const<a href="qcolor.html">QColor</a>&c)</h3>
<p>Sets the color of the brush in <em>gr</em> used for color role <em>r</em> to <em>c.</em>
<p>See also  <a href="#acc79b">color</a>(), <a href="#d95c94">setBrush</a>() and <a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a>.
<h3 class="fn">void<a name="7981c8"></a>QPalette::setColor(ColorGroupgr, <a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a>r, const<a href="qcolor.html">QColor</a>&c)</h3>
<p>Sets the brush in <em>gr</em> used for color role <em>r</em> to the solid color <em>c.</em>
<p>See also  <a href="#d95c94">setBrush</a>(), <a href="#acc79b">color</a>() and <a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a>.
<h3 class="fn">void<a name="be00a5"></a>QPalette::setDisabled(const<a href="qcolorgroup.html">QColorGroup</a>&g)</h3>
<p>Sets the <code>Disabled</code> color group to <em>g.</em>
<p>See also  <a href="#a67ec0">disabled</a>(), <a href="#ef09be">setActive</a>() and <a href="#497f86">setInactive</a>().
<h3 class="fn">void<a name="497f86"></a>QPalette::setInactive(const<a href="qcolorgroup.html">QColorGroup</a>&g)</h3>
<p>Sets the <code>Inactive</code> color group to <em>g.</em>
<p>See also  <a href="#73a182">active</a>(), <a href="#be00a5">setDisabled</a>(), <a href="#ef09be">setActive</a>() and <a href="qcolorgroup.html">QColorGroup</a>.
<h3 class="fn">void<a name="ce757a"></a>QPalette::setNormal(const<a href="qcolorgroup.html">QColorGroup</a>&g)</h3>
<p><b>This function is obsolete.</b> It is provided to keep old source working, and will probably be removed in a future version of Qt.  We strongly advise against using it in new code.<p>
<p>Use <a href="#ef09be">setActive</a>() instead.
<hr><h2>Related Functions</h2>
<h3><a href="qdatastream.html">QDataStream</a> & <a name="3613b9"></a>operator>> (<a href="qdatastream.html">QDataStream</a> & s, QPalette & p)</h3>
<p>Reads a palette from the stream and returns a reference to the stream.
<p>See also  <a href="datastreamformat.html">Format of the QDataStream operators</a>
<h3><a href="qdatastream.html">QDataStream</a> & <a name="69e1d9"></a>operator<< (<a href="qdatastream.html">QDataStream</a> & s, const QPalette & p)</h3>
<p>Writes a palette to the stream and returns a reference to the stream.
<p>See also  <a href="datastreamformat.html">Format of the QDataStream operators</a>
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.1"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 1995-2000
<a href="http://www.trolltech.com">Trolltech</a>, all rights reserved.<p><address><hr><div align="center">
<table width="100%" cellspacing="0" border="0"><tr>
<td>Copyright  2000 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.1</div>
</table></div></address></body></html>
 |