qpalette.html

来自「QT 下载资料仅供参考」· HTML 代码 · 共 309 行 · 第 1/2 页

HTML
309
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/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"><!--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: #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&nbsp;Classes</font></a> | <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a> | <a href="annotated.html"><font color="#004faf">Annotated</font></a> | <a href="groups.html"><font color="#004faf">Grouped&nbsp;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 &lt;<a href="qpalette-h.html">qpalette.h</a>&gt;</tt><p><a href="qpalette-members.html">List of all member functions.</a><h2>Public Members</h2><ul><li><div class=fn><a href="#QPalette"><b>QPalette</b></a> ()</div></li><li><div class=fn>QPalette ( const&nbsp;QColor&nbsp;&amp;&nbsp;button ) &nbsp;<em>(obsolete)</em></div></li><li><div class=fn><a href="#QPalette-3"><b>QPalette</b></a> ( const&nbsp;QColor&nbsp;&amp;&nbsp;button, const&nbsp;QColor&nbsp;&amp;&nbsp;background )</div></li><li><div class=fn><a href="#QPalette-4"><b>QPalette</b></a> ( const&nbsp;QColorGroup&nbsp;&amp;&nbsp;active, const&nbsp;QColorGroup&nbsp;&amp;&nbsp;disabled, const&nbsp;QColorGroup&nbsp;&amp;&nbsp;inactive )</div></li><li><div class=fn><a href="#QPalette-5"><b>QPalette</b></a> ( const&nbsp;QPalette&nbsp;&amp;&nbsp;p )</div></li><li><div class=fn><a href="#~QPalette"><b>~QPalette</b></a> ()</div></li><li><div class=fn>QPalette &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;QPalette&nbsp;&amp;&nbsp;p )</div></li><li><div class=fn>enum <a href="#ColorGroup-enum"><b>ColorGroup</b></a> { Disabled, Active, Inactive, NColorGroups, Normal = Active }</div></li><li><div class=fn>const QColor &amp; <a href="#color"><b>color</b></a> ( ColorGroup&nbsp;gr, QColorGroup::ColorRole&nbsp;r ) const</div></li><li><div class=fn>const QBrush &amp; <a href="#brush"><b>brush</b></a> ( ColorGroup&nbsp;gr, QColorGroup::ColorRole&nbsp;r ) const</div></li><li><div class=fn>void <a href="#setColor"><b>setColor</b></a> ( ColorGroup&nbsp;gr, QColorGroup::ColorRole&nbsp;r, const&nbsp;QColor&nbsp;&amp;&nbsp;c )</div></li><li><div class=fn>void <a href="#setBrush"><b>setBrush</b></a> ( ColorGroup&nbsp;gr, QColorGroup::ColorRole&nbsp;r, const&nbsp;QBrush&nbsp;&amp;&nbsp;b )</div></li><li><div class=fn>void <a href="#setColor-2"><b>setColor</b></a> ( QColorGroup::ColorRole&nbsp;r, const&nbsp;QColor&nbsp;&amp;&nbsp;c )</div></li><li><div class=fn>void <a href="#setBrush-2"><b>setBrush</b></a> ( QColorGroup::ColorRole&nbsp;r, const&nbsp;QBrush&nbsp;&amp;&nbsp;b )</div></li><li><div class=fn>QPalette <a href="#copy"><b>copy</b></a> () const</div></li><li><div class=fn>const QColorGroup &amp; <a href="#active"><b>active</b></a> () const</div></li><li><div class=fn>const QColorGroup &amp; <a href="#disabled"><b>disabled</b></a> () const</div></li><li><div class=fn>const QColorGroup &amp; <a href="#inactive"><b>inactive</b></a> () const</div></li><li><div class=fn>const QColorGroup &amp; normal () const &nbsp;<em>(obsolete)</em></div></li><li><div class=fn>void <a href="#setActive"><b>setActive</b></a> ( const&nbsp;QColorGroup&nbsp;&amp;&nbsp;g )</div></li><li><div class=fn>void <a href="#setDisabled"><b>setDisabled</b></a> ( const&nbsp;QColorGroup&nbsp;&amp;&nbsp;g )</div></li><li><div class=fn>void <a href="#setInactive"><b>setInactive</b></a> ( const&nbsp;QColorGroup&nbsp;&amp;&nbsp;g )</div></li><li><div class=fn>void setNormal ( const&nbsp;QColorGroup&nbsp;&amp;&nbsp;cg ) &nbsp;<em>(obsolete)</em></div></li><li><div class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;QPalette&nbsp;&amp;&nbsp;p ) const</div></li><li><div class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const&nbsp;QPalette&nbsp;&amp;&nbsp;p ) const</div></li><li><div class=fn>bool <a href="#isCopyOf"><b>isCopyOf</b></a> ( const&nbsp;QPalette&nbsp;&amp;&nbsp;p )</div></li><li><div class=fn>int <a href="#serialNumber"><b>serialNumber</b></a> () const</div></li></ul><h2>Related Functions</h2><ul><li><div class=fn>QDataStream &amp; <a href="#operator-lt-lt"><b>operator&lt;&lt;</b></a> ( QDataStream&nbsp;&amp;&nbsp;s, const&nbsp;QPalette&nbsp;&amp;&nbsp;p )</div></li><li><div class=fn>QDataStream &amp; <a href="#operator-gt-gt"><b>operator&gt;&gt;</b></a> ( QDataStream&nbsp;&amp;&nbsp;s, QPalette&nbsp;&amp;&nbsp;p )</div></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 inQt use their palette to draw themselves. This makes the userinterface easily configurable and easier to keep consistent.<p> If you create a new widget we strongly recommend that you use thecolors 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 aredisabled 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 Motif style, active() and inactive() look the same. In Windows2000 style and Macintosh Platinum style, the two styles lookslightly different.<p> There are <a href="#setActive">setActive</a>(), <a href="#setInactive">setInactive</a>(), and <a href="#setDisabled">setDisabled</a>() functionsto modify the palette. (Qt also supports a <a href="#normal">normal</a>() group; this isan obsolete alias for active(), supported for backwardscompatibility.)<p> Colors and brushes can be set for particular roles in any of apalette'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 seeif 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 blackcolors.<h3 class=fn><a name="QPalette-2"></a>QPalette::QPalette ( const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;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 areautomatically calculated, based on this color. Background will bethe button color as well.<h3 class=fn><a name="QPalette-3"></a>QPalette::QPalette ( const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;button, const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;background )</h3>Constructs a palette from a <em>button</em> color and a <em>background</em>.The other colors are automatically calculated, based on thesecolors.<h3 class=fn><a name="QPalette-4"></a>QPalette::QPalette ( const&nbsp;<a href="qcolorgroup.html">QColorGroup</a>&nbsp;&amp;&nbsp;active, const&nbsp;<a href="qcolorgroup.html">QColorGroup</a>&nbsp;&amp;&nbsp;disabled, const&nbsp;<a href="qcolorgroup.html">QColorGroup</a>&nbsp;&amp;&nbsp;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 groupsand <a href="qcolorgroup.html#ColorRole-enum">QColorGroup::ColorRole</a> for definitions of each color rolein 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&nbsp;<a href="qpalette.html">QPalette</a>&nbsp;&amp;&nbsp;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&nbsp;<a href="qcolorgroup.html">QColorGroup</a>&nbsp;&amp; <a name="active"></a>QPalette::active () const</h3>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?