⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qcolorgroup.html

📁 QT 下载资料仅供参考
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!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:48 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>QColorGroup 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>QColorGroup Class Reference</h1><p>The QColorGroup class contains a group of widget colors.<a href="#details">More...</a><p><tt>#include &lt;<a href="qpalette-h.html">qpalette.h</a>&gt;</tt><p><a href="qcolorgroup-members.html">List of all member functions.</a><h2>Public Members</h2><ul><li><div class=fn><a href="#QColorGroup"><b>QColorGroup</b></a> ()</div></li><li><div class=fn>QColorGroup ( const&nbsp;QColor&nbsp;&amp;&nbsp;foreground, const&nbsp;QColor&nbsp;&amp;&nbsp;background, const&nbsp;QColor&nbsp;&amp;&nbsp;light, const&nbsp;QColor&nbsp;&amp;&nbsp;dark, const&nbsp;QColor&nbsp;&amp;&nbsp;mid, const&nbsp;QColor&nbsp;&amp;&nbsp;text, const&nbsp;QColor&nbsp;&amp;&nbsp;base ) &nbsp;<em>(obsolete)</em></div></li><li><div class=fn><a href="#QColorGroup-3"><b>QColorGroup</b></a> ( const&nbsp;QBrush&nbsp;&amp;&nbsp;foreground, const&nbsp;QBrush&nbsp;&amp;&nbsp;button, const&nbsp;QBrush&nbsp;&amp;&nbsp;light, const&nbsp;QBrush&nbsp;&amp;&nbsp;dark, const&nbsp;QBrush&nbsp;&amp;&nbsp;mid, const&nbsp;QBrush&nbsp;&amp;&nbsp;text, const&nbsp;QBrush&nbsp;&amp;&nbsp;bright_text, const&nbsp;QBrush&nbsp;&amp;&nbsp;base, const&nbsp;QBrush&nbsp;&amp;&nbsp;background )</div></li><li><div class=fn><a href="#QColorGroup-4"><b>QColorGroup</b></a> ( const&nbsp;QColorGroup&nbsp;&amp;&nbsp;other )</div></li><li><div class=fn><a href="#~QColorGroup"><b>~QColorGroup</b></a> ()</div></li><li><div class=fn>QColorGroup &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;QColorGroup&nbsp;&amp;&nbsp;other )</div></li><li><div class=fn>enum <a href="#ColorRole-enum"><b>ColorRole</b></a> { Foreground, Button, Light, Midlight, Dark, Mid, Text, BrightText, ButtonText, Base, Background, Shadow, Highlight, HighlightedText, Link, LinkVisited, NColorRoles }</div></li><li><div class=fn>const QColor &amp; <a href="#color"><b>color</b></a> ( ColorRole&nbsp;r ) const</div></li><li><div class=fn>const QBrush &amp; <a href="#brush"><b>brush</b></a> ( ColorRole&nbsp;r ) const</div></li><li><div class=fn>void <a href="#setColor"><b>setColor</b></a> ( ColorRole&nbsp;r, const&nbsp;QColor&nbsp;&amp;&nbsp;c )</div></li><li><div class=fn>void <a href="#setBrush"><b>setBrush</b></a> ( ColorRole&nbsp;r, const&nbsp;QBrush&nbsp;&amp;&nbsp;b )</div></li><li><div class=fn>const QColor &amp; <a href="#foreground"><b>foreground</b></a> () const</div></li><li><div class=fn>const QColor &amp; <a href="#button"><b>button</b></a> () const</div></li><li><div class=fn>const QColor &amp; <a href="#light"><b>light</b></a> () const</div></li><li><div class=fn>const QColor &amp; <a href="#dark"><b>dark</b></a> () const</div></li><li><div class=fn>const QColor &amp; <a href="#mid"><b>mid</b></a> () const</div></li><li><div class=fn>const QColor &amp; <a href="#text"><b>text</b></a> () const</div></li><li><div class=fn>const QColor &amp; <a href="#base"><b>base</b></a> () const</div></li><li><div class=fn>const QColor &amp; <a href="#background"><b>background</b></a> () const</div></li><li><div class=fn>const QColor &amp; <a href="#midlight"><b>midlight</b></a> () const</div></li><li><div class=fn>const QColor &amp; <a href="#brightText"><b>brightText</b></a> () const</div></li><li><div class=fn>const QColor &amp; <a href="#buttonText"><b>buttonText</b></a> () const</div></li><li><div class=fn>const QColor &amp; <a href="#shadow"><b>shadow</b></a> () const</div></li><li><div class=fn>const QColor &amp; <a href="#highlight"><b>highlight</b></a> () const</div></li><li><div class=fn>const QColor &amp; <a href="#highlightedText"><b>highlightedText</b></a> () const</div></li><li><div class=fn>const QColor &amp; <a href="#link"><b>link</b></a> () const</div></li><li><div class=fn>const QColor &amp; <a href="#linkVisited"><b>linkVisited</b></a> () const</div></li><li><div class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;QColorGroup&nbsp;&amp;&nbsp;g ) const</div></li><li><div class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const&nbsp;QColorGroup&nbsp;&amp;&nbsp;g ) 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;QColorGroup&nbsp;&amp;&nbsp;g )</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2>The QColorGroup class contains a group of widget colors.<p> <p> A color group contains a group of colors used by widgets fordrawing themselves. We recommend that widgets use color grouproles such as "foreground" and "base" rather than literal colorslike "red" or "turqoise". The color roles are enumerated anddefined in the <a href="#ColorRole-enum">ColorRole</a> documentation.<p> The most common use of QColorGroup is like this:<p> <pre>        <a href="qpainter.html">QPainter</a> p;        ...        p.<a href="qpainter.html#setPen">setPen</a>( colorGroup().foreground() );        p.<a href="qpainter.html#drawLine">drawLine</a>( ... )    </pre> <p> It is also possible to modify color groups or create new colorgroups from scratch.<p> The color group class can be created using three differentconstructors or by modifying one supplied by Qt. The defaultconstructor creates an all-black color group, which can then bemodified using set functions; there's also a constructor forspecifying all the color group colors. And there is also a copyconstructor.<p> We strongly recommend using a system-supplied color group andmodifying that as necessary.<p> You modify a color group by calling the access functions<a href="#setColor">setColor</a>() and <a href="#setBrush">setBrush</a>(), depending on whether you want a purecolor or a pixmap pattern.<p> There are also corresponding <a href="#color">color</a>() and <a href="#brush">brush</a>() getters, and acommonly used convenience function to get each ColorRole:<a href="#background">background</a>(), <a href="#foreground">foreground</a>(), <a href="#base">base</a>(), etc.<p> <p>See also <a href="qcolor.html">QColor</a>, <a href="qpalette.html">QPalette</a>, <a href="qwidget.html#colorGroup-prop">QWidget::colorGroup</a>, <a href="appearance.html">Widget Appearance and Style</a>, <a href="graphics.html">Graphics Classes</a> and <a href="images.html">Image Processing Classes</a>.<hr><h2>Member Type Documentation</h2><h3 class=fn><a name="ColorRole-enum"></a>QColorGroup::ColorRole</h3><p> The ColorRole enum defines the different symbolic color roles usedin current GUIs.<p> The central roles are:<ul><li><tt>QColorGroup::Background</tt> - general background color.<li><tt>QColorGroup::Foreground</tt> - general foreground color.<li><tt>QColorGroup::Base</tt> - used as background color for text entry widgets, for example;usually white or another light color.<li><tt>QColorGroup::Text</tt> - the foreground color used with <a href="#ColorRole-enum">Base</a>. Usually thisis the same as the <a href="#ColorRole-enum">Foreground</a>, in which case it must provide goodcontrast with <a href="#ColorRole-enum">Background</a> and <a href="#ColorRole-enum">Base</a>.<li><tt>QColorGroup::Button</tt> - general button background color in which buttons need abackground different from <a href="#ColorRole-enum">Background</a>, as in the Macintosh style.<li><tt>QColorGroup::ButtonText</tt> - a foreground color used with the <a href="#ColorRole-enum">Button</a> color.</ul><p> There are some color roles used mostly for 3D bevel and shadoweffects:<ul><li><tt>QColorGroup::Light</tt> - lighter than <a href="#ColorRole-enum">Button</a> color.<li><tt>QColorGroup::Midlight</tt> - between <a href="#ColorRole-enum">Button</a> and <a href="#ColorRole-enum">Light</a>.<li><tt>QColorGroup::Dark</tt> - darker than <a href="#ColorRole-enum">Button</a>.<li><tt>QColorGroup::Mid</tt> - between <a href="#ColorRole-enum">Button</a> and <a href="#ColorRole-enum">Dark</a>.<li><tt>QColorGroup::Shadow</tt> - a very dark color.By default, the shadow color is <tt>Qt::black</tt>.</ul><p> All of these are normally derived from <a href="#ColorRole-enum">Background</a> and used inways that depend on that relationship. For example, buttons dependon it to make the bevels look attractive, and Motif scroll barsdepend on <a href="#ColorRole-enum">Mid</a> to be slightly different from <a href="#ColorRole-enum">Background</a>.<p> Selected (marked) items have two roles:<ul><li><tt>QColorGroup::Highlight</tt> - a color to indicate a selected or highlighted item.By default, the highlight color is <tt>Qt::darkBlue</tt>.<li><tt>QColorGroup::HighlightedText</tt> - a text color that contrasts with <a href="#ColorRole-enum">Highlight</a>.By default, the highlighted text color is <tt>Qt::white</tt>.</ul><p> Finally, there is a special role for text that needs to bedrawn where <a href="#ColorRole-enum">Text</a> or <a href="#ColorRole-enum">Foreground</a> would give poor contrast,such as on pressed push buttons:<ul><li><tt>QColorGroup::BrightText</tt> - a text color that is very different from <a href="#ColorRole-enum">Foreground</a> and contrasts well with e.g. <a href="#ColorRole-enum">Dark</a>.<li><tt>QColorGroup::Link</tt> - a text color used for unvisited hyperlinks.By default, the link color is <tt>Qt::blue</tt>.<li><tt>QColorGroup::LinkVisited</tt> - a text color used for already visited hyperlinks.By default, the linkvisited color is <tt>Qt::magenta</tt>.<li><tt>QColorGroup::NColorRoles</tt> - Internal.</ul><p> Note that text colors can be used for things other than justwords; text colors are <em>usually</em> used for text, but it's quitecommon to use the text color roles for lines, icons, etc.<p> This image shows most of the color roles in use:<center><img src="palette.png" alt="Color Roles"></center> <hr><h2>Member Function Documentation</h2><h3 class=fn><a name="QColorGroup"></a>QColorGroup::QColorGroup ()</h3>Constructs a color group with all colors set to black.<h3 class=fn><a name="QColorGroup-2"></a>QColorGroup::QColorGroup ( const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;foreground, const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;background, const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;light, const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;dark, const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;mid, const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;text, const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;base )</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 color group with the specified colors. The buttoncolor will be set to the background color.<h3 class=fn><a name="QColorGroup-3"></a>QColorGroup::QColorGroup ( const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;&amp;&nbsp;foreground, const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;&amp;&nbsp;button, const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;&amp;&nbsp;light, const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;&amp;&nbsp;dark, const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;&amp;&nbsp;mid, const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;&amp;&nbsp;text, const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;&amp;&nbsp;bright_text, const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;&amp;&nbsp;base, const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;&amp;&nbsp;background )</h3>

⌨️ 快捷键说明

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