Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 112b0974ad288f6cd55bf971ee6026a9 > files > 891

libqt3-devel-3.0.2-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/src/kernel/qpainter.cpp:3301 -->
<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 a custom
pattern, which is defined by a <a href="qpixmap.html">QPixmap</a>.
<p> The brush style defines the fill pattern. The default brush style is <a href="qt.html#BrushStyle-enum">NoBrush</a> (depends on how you construct a brush).  This style tells the
painter to not fill shapes. The standard style for filling is called <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> (will not 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>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>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 pattern
stored in <em>pixmap</em>.
<p> The color will only have an effect for monochrome pixmaps, i.e.,
<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>

Returns the brush color.
<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>

Returns TRUE if the brush is different from <em>b</em> or FALSE if the brushes are
equal.
<p> Two brushes are different if they have different styles, colors or pixmaps.
<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>, or FALSE if the brushes are
different.
<p> Two brushes are equal if they have equal styles, colors and pixmaps.
<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>

Returns a pointer to the custom brush pattern.
<p> A null pointer is returned if no custom brush pattern has been set.
<p> <p>See also <a href="#setPixmap">setPixmap</a>().

<p>Example: <a href="richtext-example.html#x591">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>See also <a href="#color">color</a>() and <a href="#setStyle">setStyle</a>().

<p>Example: <a href="picture-example.html#x905">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 monochrome pixmaps,
i.e.	<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#x592">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:
<ul>
<li> NoBrush  will not fill shapes (default).
<li> SolidPattern  solid (100%) fill pattern.
<li> Dense1Pattern  94% fill pattern.
<li> Dense2Pattern  88% fill pattern.
<li> Dense3Pattern  63% fill pattern.
<li> Dense4Pattern  50% fill pattern.
<li> Dense5Pattern  37% fill pattern.
<li> Dense6Pattern  12% fill pattern.
<li> Dense7Pattern  6% fill pattern.
<li> HorPattern  horizontal lines pattern.
<li> VerPattern  vertical lines pattern.
<li> CrossPattern  crossing lines pattern.
<li> BDiagPattern  diagonal lines (directed / ) pattern.
<li> FDiagPattern  diagonal lines (directed &#92; ) pattern.
<li> DiagCrossPattern  diagonal crossing lines pattern.
<li> CustomPattern  set when a pixmap pattern is being used.
</ul>
<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>

Returns the brush style.
<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>

Writes the brush <em>b</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>&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>

Reads the brush <em>b</em> from 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>.

<!-- eof -->
<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 &copy; 2001 
<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.2</div>
</table></div></address></body>
</html>