qbrush.html

来自「QT 下载资料仅供参考」· HTML 代码 · 共 238 行

HTML
238
字号
<!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/qpainter.cpp:3491 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>QBrush 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>QBrush Class Reference</h1><p>The QBrush class defines the fill pattern of shapes drawn by a QPainter.<a href="#details">More...</a><p><tt>#include &lt;<a href="qbrush-h.html">qbrush.h</a>&gt;</tt><p>Inherits <a href="qt.html">Qt</a>.<p><a href="qbrush-members.html">List of all member functions.</a><h2>Public Members</h2><ul><li><div class=fn><a href="#QBrush"><b>QBrush</b></a> ()</div></li><li><div class=fn><a href="#QBrush-2"><b>QBrush</b></a> ( BrushStyle&nbsp;style )</div></li><li><div class=fn><a href="#QBrush-3"><b>QBrush</b></a> ( const&nbsp;QColor&nbsp;&amp;&nbsp;color, BrushStyle&nbsp;style = SolidPattern )</div></li><li><div class=fn><a href="#QBrush-4"><b>QBrush</b></a> ( const&nbsp;QColor&nbsp;&amp;&nbsp;color, const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap )</div></li><li><div class=fn><a href="#QBrush-5"><b>QBrush</b></a> ( const&nbsp;QBrush&nbsp;&amp;&nbsp;b )</div></li><li><div class=fn><a href="#~QBrush"><b>~QBrush</b></a> ()</div></li><li><div class=fn>QBrush &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;QBrush&nbsp;&amp;&nbsp;b )</div></li><li><div class=fn>BrushStyle <a href="#style"><b>style</b></a> () const</div></li><li><div class=fn>void <a href="#setStyle"><b>setStyle</b></a> ( BrushStyle&nbsp;s )</div></li><li><div class=fn>const QColor &amp; <a href="#color"><b>color</b></a> () const</div></li><li><div class=fn>void <a href="#setColor"><b>setColor</b></a> ( const&nbsp;QColor&nbsp;&amp;&nbsp;c )</div></li><li><div class=fn>QPixmap * <a href="#pixmap"><b>pixmap</b></a> () const</div></li><li><div class=fn>void <a href="#setPixmap"><b>setPixmap</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap )</div></li><li><div class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;QBrush&nbsp;&amp;&nbsp;b ) const</div></li><li><div class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const&nbsp;QBrush&nbsp;&amp;&nbsp;b ) 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;QBrush&nbsp;&amp;&nbsp;b )</div></li><li><div class=fn>QDataStream &amp; <a href="#operator-gt-gt"><b>operator&gt;&gt;</b></a> ( QDataStream&nbsp;&amp;&nbsp;s, QBrush&nbsp;&amp;&nbsp;b )</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2><p> The QBrush class defines the fill pattern of shapes drawn by a <a href="qpainter.html">QPainter</a>.<p> <p> A brush has a style and a color. One of the brush styles is acustom pattern, which is defined by a <a href="qpixmap.html">QPixmap</a>.<p> The brush style defines the fill pattern. The default brush styleis <a href="qt.html#BrushStyle-enum">NoBrush</a> (depending on how you construct a brush). This styletells the painter to not fill shapes. The standard style forfilling is <a href="qt.html#BrushStyle-enum">SolidPattern</a>.<p> The brush color defines the color of the fill pattern. The <a href="qcolor.html">QColor</a>documentation lists the predefined colors.<p> Use the <a href="qpen.html">QPen</a> class for specifying line/outline styles.<p> Example:<pre>        <a href="qpainter.html">QPainter</a> painter;        QBrush   brush( yellow );           // yellow solid pattern        painter.<a href="qpainter.html#begin">begin</a>( &amp;anyPaintDevice );   // paint something        painter.<a href="qpainter.html#setBrush">setBrush</a>( brush );          // set the yellow brush        painter.<a href="qpainter.html#setPen">setPen</a>( <a href="qt.html#PenStyle-enum">NoPen</a> );            // do not draw outline        painter.<a href="qpainter.html#drawRect">drawRect</a>( 40,30, 200,100 ); // draw filled rectangle        painter.<a href="qpainter.html#setBrush">setBrush</a>( <a href="qt.html#BrushStyle-enum">NoBrush</a> );        // do not fill        painter.<a href="qpainter.html#setPen">setPen</a>( black );            // set black pen, 0 pixel width        painter.<a href="qpainter.html#drawRect">drawRect</a>( 10,10, 30,20 );   // draw rectangle outline        painter.<a href="qpainter.html#end">end</a>();                      // painting done    </pre> <p> See the <a href="#setStyle">setStyle</a>() function for a complete list of brush styles.<p> <center><img src="brush-styles.png" alt="Brush Styles"></center> <p> <p>See also <a href="qpainter.html">QPainter</a>, <a href="qpainter.html#setBrush">QPainter::setBrush</a>(), <a href="qpainter.html#setBrushOrigin">QPainter::setBrushOrigin</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 Function Documentation</h2><h3 class=fn><a name="QBrush"></a>QBrush::QBrush ()</h3>Constructs a default black brush with the style <a href="qt.html#BrushStyle-enum">NoBrush</a> (willnot fill shapes).<h3 class=fn><a name="QBrush-2"></a>QBrush::QBrush ( <a href="qt.html#BrushStyle-enum">BrushStyle</a>&nbsp;style )</h3>Constructs a black brush with the style <em>style</em>.<p> <p>See also <a href="#setStyle">setStyle</a>().<h3 class=fn><a name="QBrush-3"></a>QBrush::QBrush ( const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;color, <a href="qt.html#BrushStyle-enum">BrushStyle</a>&nbsp;style = SolidPattern )</h3>Constructs a brush with the color <em>color</em> and the style <em>style</em>.<p> <p>See also <a href="#setColor">setColor</a>() and <a href="#setStyle">setStyle</a>().<h3 class=fn><a name="QBrush-4"></a>QBrush::QBrush ( const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;color, const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pixmap )</h3>Constructs a brush with the color <em>color</em> and a custom patternstored in <em>pixmap</em>.<p> The color will only have an effect for monochrome pixmaps, i.e.for <a href="qpixmap.html#depth">QPixmap::depth</a>() == 1.<p> <p>See also <a href="#setColor">setColor</a>() and <a href="#setPixmap">setPixmap</a>().<h3 class=fn><a name="QBrush-5"></a>QBrush::QBrush ( const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;&amp;&nbsp;b )</h3>Constructs a brush that is a <a href="shclass.html">shallow    copy</a> of <em>b</em>.<h3 class=fn><a name="~QBrush"></a>QBrush::~QBrush ()</h3>Destroys the brush.<h3 class=fn>const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp; <a name="color"></a>QBrush::color () const</h3><p> Returns the brush color.<p> <p>See also <a href="#setColor">setColor</a>().<h3 class=fn>bool <a name="operator!-eq"></a>QBrush::operator!= ( const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;&amp;&nbsp;b ) const</h3><p> Returns TRUE if the brush is different from <em>b</em>; otherwisereturns FALSE.<p> Two brushes are different if they have different styles, colors orpixmaps.<p> <p>See also <a href="#operator-eq-eq">operator==</a>().<h3 class=fn><a href="qbrush.html">QBrush</a>&nbsp;&amp; <a name="operator-eq"></a>QBrush::operator= ( const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;&amp;&nbsp;b )</h3>Assigns <em>b</em> to this brush and returns a reference to this brush.<h3 class=fn>bool <a name="operator-eq-eq"></a>QBrush::operator== ( const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;&amp;&nbsp;b ) const</h3>Returns TRUE if the brush is equal to <em>b</em>; otherwise returnsFALSE.<p> Two brushes are equal if they have equal styles, colors andpixmaps.<p> <p>See also <a href="#operator!-eq">operator!=</a>().<h3 class=fn><a href="qpixmap.html">QPixmap</a>&nbsp;* <a name="pixmap"></a>QBrush::pixmap () const</h3><p> Returns a pointer to the custom brush pattern, or 0 if no custombrush pattern has been set.<p> <p>See also <a href="#setPixmap">setPixmap</a>().<p>Example: <a href="richtext-example.html#x579">richtext/richtext.cpp</a>.<h3 class=fn>void <a name="setColor"></a>QBrush::setColor ( const&nbsp;<a href="qcolor.html">QColor</a>&nbsp;&amp;&nbsp;c )</h3>Sets the brush color to <em>c</em>.<p> <p>See also <a href="#color">color</a>() and <a href="#setStyle">setStyle</a>().<p>Example: <a href="picture-example.html#x76">picture/picture.cpp</a>.<h3 class=fn>void <a name="setPixmap"></a>QBrush::setPixmap ( const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pixmap )</h3>Sets the brush pixmap to <em>pixmap</em>. The style is set to <a href="qt.html#BrushStyle-enum">CustomPattern</a>.<p> The current brush color will only have an effect for monochromepixmaps, i.e. for <a href="qpixmap.html#depth">QPixmap::depth</a>() == 1.<p> <p>See also <a href="#pixmap">pixmap</a>() and <a href="#color">color</a>().<p>Example: <a href="richtext-example.html#x580">richtext/richtext.cpp</a>.<h3 class=fn>void <a name="setStyle"></a>QBrush::setStyle ( <a href="qt.html#BrushStyle-enum">BrushStyle</a>&nbsp;s )</h3>Sets the brush style to <em>s</em>.<p> The brush styles are:<center><table cellpadding="4" cellspacing="2" border="0"><tr bgcolor="#a2c511"> <th valign="top">Pattern <th valign="top">Meaning<tr bgcolor="#f0f0f0"> <td valign="top">NoBrush <td valign="top">will not fill shapes (default).<tr bgcolor="#d0d0d0"> <td valign="top">SolidPattern  <td valign="top">solid (100%) fill pattern.<tr bgcolor="#f0f0f0"> <td valign="top">Dense1Pattern <td valign="top" colspan="1" rowspan="1"> 94% fill pattern.<tr bgcolor="#d0d0d0"> <td valign="top">Dense2Pattern <td valign="top" colspan="1" rowspan="1"> 88% fill pattern.<tr bgcolor="#f0f0f0"> <td valign="top">Dense3Pattern <td valign="top" colspan="1" rowspan="1"> 63% fill pattern.<tr bgcolor="#d0d0d0"> <td valign="top">Dense4Pattern <td valign="top" colspan="1" rowspan="1"> 50% fill pattern.<tr bgcolor="#f0f0f0"> <td valign="top">Dense5Pattern <td valign="top" colspan="1" rowspan="1"> 37% fill pattern.<tr bgcolor="#d0d0d0"> <td valign="top">Dense6Pattern <td valign="top" colspan="1" rowspan="1"> 12% fill pattern.<tr bgcolor="#f0f0f0"> <td valign="top">Dense7Pattern <td valign="top" colspan="1" rowspan="1"> 6% fill pattern.<tr bgcolor="#d0d0d0"> <td valign="top">HorPattern <td valign="top">horizontal lines pattern.<tr bgcolor="#f0f0f0"> <td valign="top">VerPattern <td valign="top">vertical lines pattern.<tr bgcolor="#d0d0d0"> <td valign="top">CrossPattern <td valign="top">crossing lines pattern.<tr bgcolor="#f0f0f0"> <td valign="top">BDiagPattern <td valign="top">diagonal lines (directed /) pattern.<tr bgcolor="#d0d0d0"> <td valign="top">FDiagPattern <td valign="top">diagonal lines (directed &#92;) pattern.<tr bgcolor="#f0f0f0"> <td valign="top">DiagCrossPattern <td valign="top">diagonal crossing lines pattern.<tr bgcolor="#d0d0d0"> <td valign="top">CustomPattern <td valign="top">set when a pixmap pattern is being used.</table></center><p> On Windows, only the dense patterns are transparent.<p> See the <a href="#details">Detailed Description</a> for a pictureof all the styles.<p> <p>See also <a href="#style">style</a>().<h3 class=fn><a href="qt.html#BrushStyle-enum">BrushStyle</a> <a name="style"></a>QBrush::style () const</h3><p> Returns the brush style.<p> <p>See also <a href="#setStyle">setStyle</a>().<hr><h2>Related Functions</h2><h3 class=fn><a href="qdatastream.html">QDataStream</a>&nbsp;&amp; <a name="operator-lt-lt"></a>operator&lt;&lt; ( <a href="qdatastream.html">QDataStream</a>&nbsp;&amp;&nbsp;s, const&nbsp;<a href="qbrush.html">QBrush</a>&nbsp;&amp;&nbsp;b )</h3><p> Writes the brush <em>b</em> to the stream <em>s</em> and returns a referenceto 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>&nbsp;&amp; <a name="operator-gt-gt"></a>operator&gt;&gt; ( <a href="qdatastream.html">QDataStream</a>&nbsp;&amp;&nbsp;s, <a href="qbrush.html">QBrush</a>&nbsp;&amp;&nbsp;b )</h3><p> Reads the brush <em>b</em> from the stream <em>s</em> and returns a referenceto 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 &copy; 1995-2002<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 &copy; 2002 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a><td align=right><div align=right>Qt version 3.0.5</div></table></div></address></body></html>

⌨️ 快捷键说明

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