File: qpalette.html

package info (click to toggle)
qt-embedded 2.3.2-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 68,608 kB
  • ctags: 45,998
  • sloc: cpp: 276,654; ansic: 71,987; makefile: 29,074; sh: 12,305; yacc: 2,465; python: 1,863; perl: 481; lex: 480; xml: 68; lisp: 15
file content (207 lines) | stat: -rw-r--r-- 16,982 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
<!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 &lt;<a href="qpalette-h.html">qpalette.h</a>&gt;</code>
<p><a href="qpalette-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class="fn"><a href="#94aecd"><b>QPalette</b></a>()</div>
<li><div class="fn">QPalette(constQColor&amp;button)<em>(obsolete)</em></div>
<li><div class="fn"><a href="#9af016"><b>QPalette</b></a>(constQColor&amp;button, constQColor&amp;background)</div>
<li><div class="fn"><a href="#943d8b"><b>QPalette</b></a>(constQColorGroup&amp;active, constQColorGroup&amp;disabled, constQColorGroup&amp;inactive)</div>
<li><div class="fn"><a href="#649d44"><b>QPalette</b></a>(constQPalette&amp;)</div>
<li><div class="fn"><a href="#8e578d"><b>~QPalette</b></a>()</div>
<li><div class="fn">QPalette&amp;<a href="#9dea4f"><b>operator=</b></a>(constQPalette&amp;)</div>
<li><div class="fn">enum<b>ColorGroup</b>{Normal, Disabled, Active, Inactive, NColorGroups}</div>
<li><div class="fn">constQColor&amp;<a href="#5f1b3c"><b>color</b></a>(ColorGroup, QColorGroup::ColorRole)const</div>
<li><div class="fn">constQBrush&amp;<a href="#d21260"><b>brush</b></a>(ColorGroup, QColorGroup::ColorRole)const</div>
<li><div class="fn">void<a href="#93484f"><b>setColor</b></a>(ColorGroup, QColorGroup::ColorRole, constQColor&amp;)</div>
<li><div class="fn">void<a href="#343a5b"><b>setBrush</b></a>(ColorGroup, QColorGroup::ColorRole, constQBrush&amp;)</div>
<li><div class="fn">void<a href="#0a7342"><b>setColor</b></a>(QColorGroup::ColorRole, constQColor&amp;)</div>
<li><div class="fn">void<a href="#8e1ef4"><b>setBrush</b></a>(QColorGroup::ColorRole, constQBrush&amp;)</div>
<li><div class="fn">QPalette<a href="#02c539"><b>copy</b></a>()const</div>
<li><div class="fn">constQColorGroup&amp;<a href="#caf9a6"><b>active</b></a>()const</div>
<li><div class="fn">constQColorGroup&amp;<a href="#50d5fa"><b>disabled</b></a>()const</div>
<li><div class="fn">constQColorGroup&amp;<a href="#da2718"><b>inactive</b></a>()const</div>
<li><div class="fn">constQColorGroup&amp;normal()const<em>(obsolete)</em></div>
<li><div class="fn">void<a href="#97e9b0"><b>setActive</b></a>(constQColorGroup&amp;)</div>
<li><div class="fn">void<a href="#2f8f30"><b>setDisabled</b></a>(constQColorGroup&amp;)</div>
<li><div class="fn">void<a href="#41d465"><b>setInactive</b></a>(constQColorGroup&amp;)</div>
<li><div class="fn">voidsetNormal(constQColorGroup&amp;)<em>(obsolete)</em></div>
<li><div class="fn">bool<a href="#b4a06d"><b>operator==</b></a>(constQPalette&amp;p)const</div>
<li><div class="fn">bool<a href="#2409d2"><b>operator!=</b></a>(constQPalette&amp;p)const</div>
<li><div class="fn">bool<a href="#3a13b4"><b>isCopyOf</b></a>(constQPalette&amp;)</div>
<li><div class="fn">int<a href="#7a9ec3"><b>serialNumber</b></a>()const</div>
</ul>
<h2>Related Functions</h2>
(Note that these are not member functions.)
<ul>
<li>QDataStream &amp; <a href="qpalette.html#421d42"><b>operator&gt;&gt;</b></a> (QDataStream &amp; s, QPalette &amp; p)
<li>QDataStream &amp; <a href="qpalette.html#6ebf84"><b>operator&lt;&lt;</b></a> (QDataStream &amp; s, const QPalette &amp; 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="#caf9a6">active</a>() group is used for the
window that has keyboard focus. <li> The <a href="#da2718">inactive</a>() group is used
for other windows. <li> The <a href="#50d5fa">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="#97e9b0">setActive</a>(), <a href="#41d465">setInactive</a>() and <a href="#2f8f30">setDisabled</a>() functions to
modify the palette.  Qt also supports a <a href="#35368b">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#63c60d">QApplication::setPalette</a>(), <a href="qwidget.html#d7e4b9">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="94aecd"></a>QPalette::QPalette()</h3>
<p>Constructs a palette that consists of color groups with only black colors.
<h3 class="fn"><a name="150a12"></a>QPalette::QPalette(const<a href="qcolor.html">QColor</a>&amp;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="9af016"></a>QPalette::QPalette(const<a href="qcolor.html">QColor</a>&amp;button, const<a href="qcolor.html">QColor</a>&amp;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="943d8b"></a>QPalette::QPalette(const<a href="qcolorgroup.html">QColorGroup</a>&amp;active, const<a href="qcolorgroup.html">QColorGroup</a>&amp;disabled, const<a href="qcolorgroup.html">QColorGroup</a>&amp;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="649d44"></a>QPalette::QPalette(constQPalette&amp;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="8e578d"></a>QPalette::~QPalette()</h3>
<p>Destructs the palette.
<h3 class="fn">const<a href="qcolorgroup.html">QColorGroup</a>&amp;<a name="caf9a6"></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="#97e9b0">setActive</a>(), <a href="#da2718">inactive</a>() and <a href="#50d5fa">disabled</a>().
<h3 class="fn">const<a href="qbrush.html">QBrush</a>&amp;<a name="d21260"></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="#5f1b3c">color</a>(), <a href="#343a5b">setBrush</a>() and <a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a>.
<h3 class="fn">const<a href="qcolor.html">QColor</a>&amp;<a name="5f1b3c"></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="#d21260">brush</a>(), <a href="#0a7342">setColor</a>() and <a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a>.
<h3 class="fn">QPalette<a name="02c539"></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>&amp;<a name="50d5fa"></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="#2f8f30">setDisabled</a>(), <a href="#caf9a6">active</a>() and <a href="#da2718">inactive</a>().
<h3 class="fn">const<a href="qcolorgroup.html">QColorGroup</a>&amp;<a name="da2718"></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="#41d465">setInactive</a>(), <a href="#caf9a6">active</a>() and <a href="#50d5fa">disabled</a>().
<h3 class="fn">bool<a name="3a13b4"></a>QPalette::isCopyOf(constQPalette&amp;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>&amp;<a name="35368b"></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="#caf9a6">active</a>() instead.
<h3 class="fn">bool<a name="2409d2"></a>QPalette::operator!=(constQPalette&amp;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&amp;<a name="9dea4f"></a>QPalette::operator=(constQPalette&amp;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="#02c539">copy</a>().
<h3 class="fn">bool<a name="b4a06d"></a>QPalette::operator==(constQPalette&amp;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="7a9ec3"></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="#292827">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="97e9b0"></a>QPalette::setActive(const<a href="qcolorgroup.html">QColorGroup</a>&amp;g)</h3>
<p>Sets the <code>Active</code> color group to <em>g.</em>
<p>See also  <a href="#caf9a6">active</a>(), <a href="#2f8f30">setDisabled</a>(), <a href="#41d465">setInactive</a>() and <a href="qcolorgroup.html">QColorGroup</a>.
<h3 class="fn">void<a name="8e1ef4"></a>QPalette::setBrush(<a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a>r, const<a href="qbrush.html">QBrush</a>&amp;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="#d21260">brush</a>(), <a href="#0a7342">setColor</a>(), <a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a>, <a href="#caf9a6">active</a>(), <a href="#da2718">inactive</a>() and <a href="#50d5fa">disabled</a>().
<h3 class="fn">void<a name="343a5b"></a>QPalette::setBrush(ColorGroupgr, <a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a>r, const<a href="qbrush.html">QBrush</a>&amp;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="#d21260">brush</a>(), <a href="#0a7342">setColor</a>() and <a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a>.
<h3 class="fn">void<a name="0a7342"></a>QPalette::setColor(<a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a>r, const<a href="qcolor.html">QColor</a>&amp;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="#5f1b3c">color</a>(), <a href="#343a5b">setBrush</a>() and <a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a>.
<h3 class="fn">void<a name="93484f"></a>QPalette::setColor(ColorGroupgr, <a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a>r, const<a href="qcolor.html">QColor</a>&amp;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="#343a5b">setBrush</a>(), <a href="#5f1b3c">color</a>() and <a href="qcolorgroup.html#ColorRole">QColorGroup::ColorRole</a>.
<h3 class="fn">void<a name="2f8f30"></a>QPalette::setDisabled(const<a href="qcolorgroup.html">QColorGroup</a>&amp;g)</h3>
<p>Sets the <code>Disabled</code> color group to <em>g.</em>
<p>See also  <a href="#50d5fa">disabled</a>(), <a href="#97e9b0">setActive</a>() and <a href="#41d465">setInactive</a>().
<h3 class="fn">void<a name="41d465"></a>QPalette::setInactive(const<a href="qcolorgroup.html">QColorGroup</a>&amp;g)</h3>
<p>Sets the <code>Inactive</code> color group to <em>g.</em>
<p>See also  <a href="#caf9a6">active</a>(), <a href="#2f8f30">setDisabled</a>(), <a href="#97e9b0">setActive</a>() and <a href="qcolorgroup.html">QColorGroup</a>.
<h3 class="fn">void<a name="fd8863"></a>QPalette::setNormal(const<a href="qcolorgroup.html">QColorGroup</a>&amp;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="#97e9b0">setActive</a>() instead.
<hr><h2>Related Functions</h2>
<h3><a href="qdatastream.html">QDataStream</a> &amp; <a name="421d42"></a>operator&gt;&gt; (<a href="qdatastream.html">QDataStream</a> &amp; s, QPalette &amp; 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> &amp; <a name="6ebf84"></a>operator&lt;&lt; (<a href="qdatastream.html">QDataStream</a> &amp; s, const QPalette &amp; 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.2"><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 &copy; 1995-2001
<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  2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>