You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
240 lines
13 KiB
240 lines
13 KiB
14 years ago
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qpainter.cpp:3567 -->
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||
|
<title>QBrush Class</title>
|
||
|
<style type="text/css"><!--
|
||
|
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 Classes</font></a>
|
||
|
| <a href="mainclasses.html">
|
||
|
<font color="#004faf">Main Classes</font></a>
|
||
|
| <a href="annotated.html">
|
||
|
<font color="#004faf">Annotated</font></a>
|
||
|
| <a href="groups.html">
|
||
|
<font color="#004faf">Grouped 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 <<a href="qbrush-h.html">qbrush.h</a>></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 class=fn><a href="#QBrush"><b>QBrush</b></a> ()</li>
|
||
|
<li class=fn><a href="#QBrush-2"><b>QBrush</b></a> ( BrushStyle style )</li>
|
||
|
<li class=fn><a href="#QBrush-3"><b>QBrush</b></a> ( const QColor & color, BrushStyle style = SolidPattern )</li>
|
||
|
<li class=fn><a href="#QBrush-4"><b>QBrush</b></a> ( const QColor & color, const QPixmap & pixmap )</li>
|
||
|
<li class=fn><a href="#QBrush-5"><b>QBrush</b></a> ( const QBrush & b )</li>
|
||
|
<li class=fn><a href="#~QBrush"><b>~QBrush</b></a> ()</li>
|
||
|
<li class=fn>QBrush & <a href="#operator-eq"><b>operator=</b></a> ( const QBrush & b )</li>
|
||
|
<li class=fn>BrushStyle <a href="#style"><b>style</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#setStyle"><b>setStyle</b></a> ( BrushStyle s )</li>
|
||
|
<li class=fn>const QColor & <a href="#color"><b>color</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#setColor"><b>setColor</b></a> ( const QColor & c )</li>
|
||
|
<li class=fn>QPixmap * <a href="#pixmap"><b>pixmap</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#setPixmap"><b>setPixmap</b></a> ( const QPixmap & pixmap )</li>
|
||
|
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const QBrush & b ) const</li>
|
||
|
<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const QBrush & b ) const</li>
|
||
|
</ul>
|
||
|
<h2>Related Functions</h2>
|
||
|
<ul>
|
||
|
<li class=fn>QDataStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( QDataStream & s, const QBrush & b )</li>
|
||
|
<li class=fn>QDataStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( QDataStream & s, QBrush & b )</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> (depending on how you construct a brush). This style
|
||
|
tells the painter to not fill shapes. The standard style for
|
||
|
filling 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>( &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> 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 <a href="qcolor.html">QColor</a> & color, <a href="qt.html#BrushStyle-enum">BrushStyle</a> 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 <a href="qcolor.html">QColor</a> & color, const <a href="qpixmap.html">QPixmap</a> & 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.
|
||
|
for <a href="qpixmap.html#depth">QPixmap::depth</a>() == 1.
|
||
|
<p> Pixmap brushes are currently not supported when printing on X11.
|
||
|
<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 <a href="qbrush.html">QBrush</a> & 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 <a href="qcolor.html">QColor</a> & <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 <a href="qbrush.html">QBrush</a> & b ) const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns TRUE if the brush is different from <em>b</em>; otherwise
|
||
|
returns FALSE.
|
||
|
<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> & <a name="operator-eq"></a>QBrush::operator= ( const <a href="qbrush.html">QBrush</a> & 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 <a href="qbrush.html">QBrush</a> & b ) const
|
||
|
</h3>
|
||
|
Returns TRUE if the brush is equal to <em>b</em>; otherwise returns
|
||
|
FALSE.
|
||
|
<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> * <a name="pixmap"></a>QBrush::pixmap () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns a pointer to the custom brush pattern, or 0 if no custom
|
||
|
brush pattern has been set.
|
||
|
<p> <p>See also <a href="#setPixmap">setPixmap</a>().
|
||
|
|
||
|
<p>Example: <a href="richtext-example.html#x460">richtext/richtext.cpp</a>.
|
||
|
<h3 class=fn>void <a name="setColor"></a>QBrush::setColor ( const <a href="qcolor.html">QColor</a> & 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#x108">picture/picture.cpp</a>.
|
||
|
<h3 class=fn>void <a name="setPixmap"></a>QBrush::setPixmap ( const <a href="qpixmap.html">QPixmap</a> & 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. for <a href="qpixmap.html#depth">QPixmap::depth</a>() == 1.
|
||
|
<p> Pixmap brushes are currently not supported when printing on X11.
|
||
|
<p> <p>See also <a href="#pixmap">pixmap</a>() and <a href="#color">color</a>().
|
||
|
|
||
|
<p>Example: <a href="richtext-example.html#x461">richtext/richtext.cpp</a>.
|
||
|
<h3 class=fn>void <a name="setStyle"></a>QBrush::setStyle ( <a href="qt.html#BrushStyle-enum">BrushStyle</a> 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 \) 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, dense and custom patterns cannot be transparent.
|
||
|
<p> See the <a href="#details">Detailed Description</a> for a picture
|
||
|
of 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> & <a name="operator-lt-lt"></a>operator<< ( <a href="qdatastream.html">QDataStream</a> & s, const <a href="qbrush.html">QBrush</a> & b )
|
||
|
</h3>
|
||
|
|
||
|
<p> 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> & <a name="operator-gt-gt"></a>operator>> ( <a href="qdatastream.html">QDataStream</a> & s, <a href="qbrush.html">QBrush</a> & b )
|
||
|
</h3>
|
||
|
|
||
|
<p> 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 © 1995-2007
|
||
|
<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 © 2007
|
||
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
||
|
<td align=right><div align=right>Qt 3.3.8</div>
|
||
|
</table></div></address></body>
|
||
|
</html>
|