/usr/share/qt3/doc/html/qpalette.html is in qt3-doc 3:3.3.8-b-8ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qpalette.cpp:512 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QPalette Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
<a href="index.html">
<font color="#004faf">Home</font></a>
| <a href="classes.html">
<font color="#004faf">All Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QPalette Class Reference</h1>
<p>The QPalette class contains color groups for each widget state.
<a href="#details">More...</a>
<p><tt>#include <<a href="qpalette-h.html">qpalette.h</a>></tt>
<p><a href="qpalette-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#QPalette"><b>QPalette</b></a> ()</li>
<li class=fn>QPalette ( const QColor & button ) <em>(obsolete)</em></li>
<li class=fn><a href="#QPalette-3"><b>QPalette</b></a> ( const QColor & button, const QColor & background )</li>
<li class=fn><a href="#QPalette-4"><b>QPalette</b></a> ( const QColorGroup & active, const QColorGroup & disabled, const QColorGroup & inactive )</li>
<li class=fn><a href="#QPalette-5"><b>QPalette</b></a> ( const QPalette & p )</li>
<li class=fn><a href="#~QPalette"><b>~QPalette</b></a> ()</li>
<li class=fn>QPalette & <a href="#operator-eq"><b>operator=</b></a> ( const QPalette & p )</li>
<li class=fn>enum <a href="#ColorGroup-enum"><b>ColorGroup</b></a> { Disabled, Active, Inactive, NColorGroups, Normal = Active }</li>
<li class=fn>const QColor & <a href="#color"><b>color</b></a> ( ColorGroup gr, QColorGroup::ColorRole r ) const</li>
<li class=fn>const QBrush & <a href="#brush"><b>brush</b></a> ( ColorGroup gr, QColorGroup::ColorRole r ) const</li>
<li class=fn>void <a href="#setColor"><b>setColor</b></a> ( ColorGroup gr, QColorGroup::ColorRole r, const QColor & c )</li>
<li class=fn>void <a href="#setBrush"><b>setBrush</b></a> ( ColorGroup gr, QColorGroup::ColorRole r, const QBrush & b )</li>
<li class=fn>void <a href="#setColor-2"><b>setColor</b></a> ( QColorGroup::ColorRole r, const QColor & c )</li>
<li class=fn>void <a href="#setBrush-2"><b>setBrush</b></a> ( QColorGroup::ColorRole r, const QBrush & b )</li>
<li class=fn>QPalette <a href="#copy"><b>copy</b></a> () const</li>
<li class=fn>const QColorGroup & <a href="#active"><b>active</b></a> () const</li>
<li class=fn>const QColorGroup & <a href="#disabled"><b>disabled</b></a> () const</li>
<li class=fn>const QColorGroup & <a href="#inactive"><b>inactive</b></a> () const</li>
<li class=fn>const QColorGroup & normal () const <em>(obsolete)</em></li>
<li class=fn>void <a href="#setActive"><b>setActive</b></a> ( const QColorGroup & g )</li>
<li class=fn>void <a href="#setDisabled"><b>setDisabled</b></a> ( const QColorGroup & g )</li>
<li class=fn>void <a href="#setInactive"><b>setInactive</b></a> ( const QColorGroup & g )</li>
<li class=fn>void setNormal ( const QColorGroup & cg ) <em>(obsolete)</em></li>
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const QPalette & p ) const</li>
<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const QPalette & p ) const</li>
<li class=fn>bool <a href="#isCopyOf"><b>isCopyOf</b></a> ( const QPalette & p )</li>
<li class=fn>int <a href="#serialNumber"><b>serialNumber</b></a> () const</li>
</ul>
<h2>Related Functions</h2>
<ul>
<li class=fn>QDataStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( QDataStream & s, const QPalette & p )</li>
<li class=fn>QDataStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( QDataStream & s, QPalette & p )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
<p> The QPalette class contains color groups for each widget state.
<p>
<p> A palette consists of three color groups: <em>active</em>, <em>disabled</em>,
and <em>inactive</em>. All widgets contain a palette, and all widgets in
Qt use their palette to draw themselves. This makes the user
interface easily configurable and easier to keep consistent.
<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> The color groups:
<ul>
<li> The <a href="#active">active</a>() group is used for the window that has <a href="focus.html#keyboard-focus">keyboard focus</a>.
<li> The <a href="#inactive">inactive</a>() group is used for other windows.
<li> The <a href="#disabled">disabled</a>() group is used for widgets (not windows) that are
disabled for some reason.
</ul>
<p> Both active and inactive windows can contain disabled widgets.
(Disabled widgets are often called <em>inaccessible</em> or <em>grayed out</em>.)
<p> In <a href="motif-extension.html#Motif">Motif</a> style, active() and inactive() look the same. In Windows
2000 style and Macintosh Platinum style, the two styles look
slightly different.
<p> There are <a href="#setActive">setActive</a>(), <a href="#setInactive">setInactive</a>(), and <a href="#setDisabled">setDisabled</a>() functions
to modify the palette. (Qt also supports a <a href="#normal">normal</a>() group; this is
an obsolete alias for active(), supported for backwards
compatibility.)
<p> Colors and brushes can be set for particular roles in any of a
palette's color groups with <a href="#setColor">setColor</a>() and <a href="#setBrush">setBrush</a>().
<p> You can copy a palette using the copy constructor and test to see
if two palettes are <em>identical</em> using <a href="#isCopyOf">isCopyOf</a>().
<p> <p>See also <a href="qapplication.html#setPalette">QApplication::setPalette</a>(), <a href="qwidget.html#palette-prop">QWidget::palette</a>, <a href="qcolorgroup.html">QColorGroup</a>, <a href="qcolor.html">QColor</a>, <a href="appearance.html">Widget Appearance and Style</a>, <a href="graphics.html">Graphics Classes</a>, <a href="images.html">Image Processing Classes</a>, and <a href="shared.html">Implicitly and Explicitly Shared Classes</a>.
<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="ColorGroup-enum"></a>QPalette::ColorGroup</h3>
<ul>
<li><tt>QPalette::Disabled</tt>
<li><tt>QPalette::Active</tt>
<li><tt>QPalette::Inactive</tt>
<li><tt>QPalette::NColorGroups</tt>
<li><tt>QPalette::Normal</tt> - synonym for Active
</ul>
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QPalette"></a>QPalette::QPalette ()
</h3>
Constructs a palette that consists of color groups with only black
colors.
<h3 class=fn><a name="QPalette-2"></a>QPalette::QPalette ( const <a href="qcolor.html">QColor</a> & button )
</h3><b>This function is obsolete.</b> It is provided to keep old source working. 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="QPalette-3"></a>QPalette::QPalette ( const <a href="qcolor.html">QColor</a> & button, const <a href="qcolor.html">QColor</a> & background )
</h3>
Constructs a palette from a <em>button</em> color and a <em>background</em>.
The other colors are automatically calculated, based on these
colors.
<h3 class=fn><a name="QPalette-4"></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>
Constructs a palette that consists of the three color groups <em>active</em>, <em>disabled</em> and <em>inactive</em>. See the <a href="#details">Detailed Description</a> for definitions of the color groups
and <a href="qcolorgroup.html#ColorRole-enum">QColorGroup::ColorRole</a> for definitions of each color role
in the three groups.
<p> <p>See also <a href="qcolorgroup.html">QColorGroup</a> and <a href="qcolorgroup.html#ColorRole-enum">QColorGroup::ColorRole</a>.
<h3 class=fn><a name="QPalette-5"></a>QPalette::QPalette ( const <a href="qpalette.html">QPalette</a> & p )
</h3>
Constructs a copy of <em>p</em>.
<p> This constructor is fast (it uses copy-on-write).
<h3 class=fn><a name="~QPalette"></a>QPalette::~QPalette ()
</h3>
Destroys the palette.
<h3 class=fn>const <a href="qcolorgroup.html">QColorGroup</a> & <a name="active"></a>QPalette::active () const
</h3>
<p> Returns the active color group of this palette.
<p> <p>See also <a href="qcolorgroup.html">QColorGroup</a>, <a href="#setActive">setActive</a>(), <a href="#inactive">inactive</a>(), and <a href="#disabled">disabled</a>().
<p>Examples: <a href="themes-example.html#x290">themes/metal.cpp</a> and <a href="themes-example.html#x224">themes/wood.cpp</a>.
<h3 class=fn>const <a href="qbrush.html">QBrush</a> & <a name="brush"></a>QPalette::brush ( <a href="qpalette.html#ColorGroup-enum">ColorGroup</a> gr, <a href="qcolorgroup.html#ColorRole-enum">QColorGroup::ColorRole</a> r ) const
</h3>
Returns the brush in color group <em>gr</em>, used for color role <em>r</em>.
<p> <p>See also <a href="#color">color</a>(), <a href="#setBrush">setBrush</a>(), and <a href="qcolorgroup.html#ColorRole-enum">QColorGroup::ColorRole</a>.
<h3 class=fn>const <a href="qcolor.html">QColor</a> & <a name="color"></a>QPalette::color ( <a href="qpalette.html#ColorGroup-enum">ColorGroup</a> gr, <a href="qcolorgroup.html#ColorRole-enum">QColorGroup::ColorRole</a> r ) const
</h3>
Returns the color in color group <em>gr</em>, used for color role <em>r</em>.
<p> <p>See also <a href="#brush">brush</a>(), <a href="#setColor">setColor</a>(), and <a href="qcolorgroup.html#ColorRole-enum">QColorGroup::ColorRole</a>.
<h3 class=fn><a href="qpalette.html">QPalette</a> <a name="copy"></a>QPalette::copy () const
</h3>
Returns a <a href="shclass.html#deep-copy">deep copy</a> of this palette.
<p> <b>Warning:</b> This is slower than the copy constructor and assignment
operator and offers no benefits.
<h3 class=fn>const <a href="qcolorgroup.html">QColorGroup</a> & <a name="disabled"></a>QPalette::disabled () const
</h3>
<p> Returns the disabled color group of this palette.
<p> <p>See also <a href="qcolorgroup.html">QColorGroup</a>, <a href="#setDisabled">setDisabled</a>(), <a href="#active">active</a>(), and <a href="#inactive">inactive</a>().
<p>Examples: <a href="themes-example.html#x291">themes/metal.cpp</a> and <a href="themes-example.html#x225">themes/wood.cpp</a>.
<h3 class=fn>const <a href="qcolorgroup.html">QColorGroup</a> & <a name="inactive"></a>QPalette::inactive () const
</h3>
<p> Returns the inactive color group of this palette.
<p> <p>See also <a href="qcolorgroup.html">QColorGroup</a>, <a href="#setInactive">setInactive</a>(), <a href="#active">active</a>(), and <a href="#disabled">disabled</a>().
<h3 class=fn>bool <a name="isCopyOf"></a>QPalette::isCopyOf ( const <a href="qpalette.html">QPalette</a> & p )
</h3>
Returns TRUE if this palette and <em>p</em> 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>See also <a href="#operator-eq">operator=</a>() and <a href="#operator-eq-eq">operator==</a>().
<h3 class=fn>const <a href="qcolorgroup.html">QColorGroup</a> & <a name="normal"></a>QPalette::normal () const
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p>
<p> Returns the active color group. Use <a href="#active">active</a>() instead.
<p> <p>See also <a href="#setActive">setActive</a>() and <a href="#active">active</a>().
<h3 class=fn>bool <a name="operator!-eq"></a>QPalette::operator!= ( const <a href="qpalette.html">QPalette</a> & p ) const
</h3>
<p> Returns TRUE (slowly) if this palette is different from <em>p</em>;
otherwise returns FALSE (usually quickly).
<h3 class=fn><a href="qpalette.html">QPalette</a> & <a name="operator-eq"></a>QPalette::operator= ( const <a href="qpalette.html">QPalette</a> & p )
</h3>
Assigns <em>p</em> to this palette and returns a reference to this
palette.
<p> This is fast (it uses copy-on-write).
<p> <p>See also <a href="#copy">copy</a>().
<h3 class=fn>bool <a name="operator-eq-eq"></a>QPalette::operator== ( const <a href="qpalette.html">QPalette</a> & p ) const
</h3>
Returns TRUE (usually quickly) if this palette is equal to <em>p</em>;
otherwise returns FALSE (slowly).
<h3 class=fn>int <a name="serialNumber"></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 (detach()), not during a
<a href="shclass.html#shallow-copy">shallow copy</a> (copy constructor or assignment).
<p> <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="setActive"></a>QPalette::setActive ( const <a href="qcolorgroup.html">QColorGroup</a> & g )
</h3>
Sets the <a href="#ColorGroup-enum">Active</a> color group to <em>g</em>.
<p> <p>See also <a href="#active">active</a>(), <a href="#setDisabled">setDisabled</a>(), <a href="#setInactive">setInactive</a>(), and <a href="qcolorgroup.html">QColorGroup</a>.
<h3 class=fn>void <a name="setBrush"></a>QPalette::setBrush ( <a href="qpalette.html#ColorGroup-enum">ColorGroup</a> gr, <a href="qcolorgroup.html#ColorRole-enum">QColorGroup::ColorRole</a> r, const <a href="qbrush.html">QBrush</a> & b )
</h3>
Sets the brush in color group <em>gr</em>, used for color role <em>r</em>, to
<em>b</em>.
<p> <p>See also <a href="#brush">brush</a>(), <a href="#setColor">setColor</a>(), and <a href="qcolorgroup.html#ColorRole-enum">QColorGroup::ColorRole</a>.
<h3 class=fn>void <a name="setBrush-2"></a>QPalette::setBrush ( <a href="qcolorgroup.html#ColorRole-enum">QColorGroup::ColorRole</a> r, const <a href="qbrush.html">QBrush</a> & b )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the brush in for color role <em>r</em> in all three color groups to
<em>b</em>.
<p> <p>See also <a href="#brush">brush</a>(), <a href="#setColor">setColor</a>(), <a href="qcolorgroup.html#ColorRole-enum">QColorGroup::ColorRole</a>, <a href="#active">active</a>(), <a href="#inactive">inactive</a>(), and <a href="#disabled">disabled</a>().
<h3 class=fn>void <a name="setColor"></a>QPalette::setColor ( <a href="qpalette.html#ColorGroup-enum">ColorGroup</a> gr, <a href="qcolorgroup.html#ColorRole-enum">QColorGroup::ColorRole</a> r, const <a href="qcolor.html">QColor</a> & c )
</h3>
Sets the brush in color group <em>gr</em>, used for color role <em>r</em>, to
the solid color <em>c</em>.
<p> <p>See also <a href="#setBrush">setBrush</a>(), <a href="#color">color</a>(), and <a href="qcolorgroup.html#ColorRole-enum">QColorGroup::ColorRole</a>.
<p>Example: <a href="themes-example.html#x332">themes/themes.cpp</a>.
<h3 class=fn>void <a name="setColor-2"></a>QPalette::setColor ( <a href="qcolorgroup.html#ColorRole-enum">QColorGroup::ColorRole</a> r, const <a href="qcolor.html">QColor</a> & c )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the brush color used for color role <em>r</em> to color <em>c</em> in all
three color groups.
<p> <p>See also <a href="#color">color</a>(), <a href="#setBrush">setBrush</a>(), and <a href="qcolorgroup.html#ColorRole-enum">QColorGroup::ColorRole</a>.
<h3 class=fn>void <a name="setDisabled"></a>QPalette::setDisabled ( const <a href="qcolorgroup.html">QColorGroup</a> & g )
</h3>
Sets the <a href="#ColorGroup-enum">Disabled</a> color group to <em>g</em>.
<p> <p>See also <a href="#disabled">disabled</a>(), <a href="#setActive">setActive</a>(), and <a href="#setInactive">setInactive</a>().
<h3 class=fn>void <a name="setInactive"></a>QPalette::setInactive ( const <a href="qcolorgroup.html">QColorGroup</a> & g )
</h3>
Sets the <a href="#ColorGroup-enum">Inactive</a> color group to <em>g</em>.
<p> <p>See also <a href="#active">active</a>(), <a href="#setDisabled">setDisabled</a>(), <a href="#setActive">setActive</a>(), and <a href="qcolorgroup.html">QColorGroup</a>.
<h3 class=fn>void <a name="setNormal"></a>QPalette::setNormal ( const <a href="qcolorgroup.html">QColorGroup</a> & cg )
</h3>
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p>
<p> Sets the active color group to <em>cg</em>. Use <a href="#setActive">setActive</a>() instead.
<p> <p>See also <a href="#setActive">setActive</a>() and <a href="#active">active</a>().
<hr><h2>Related Functions</h2>
<h3 class=fn><a href="qdatastream.html">QDataStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="qdatastream.html">QDataStream</a> & s, const <a href="qpalette.html">QPalette</a> & p )
</h3>
<p> Writes the palette, <em>p</em> to the stream <em>s</em> and returns a
reference to the stream.
<p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.
<h3 class=fn><a href="qdatastream.html">QDataStream</a> & <a name="operator-gt-gt"></a>operator>> ( <a href="qdatastream.html">QDataStream</a> & s, <a href="qpalette.html">QPalette</a> & p )
</h3>
<p> Reads a palette from the stream, <em>s</em> into the palette <em>p</em>, and
returns a reference to the stream.
<p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright © 1995-2007
<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 © 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>
|