1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - 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: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QBrush Class Reference</h1><br clear="all">
<p>
The QBrush class defines the fill pattern of shapes drawn by a <a href="qpainter.html">QPainter</a>.
<a href="#details">More...</a>
<p>
<code>#include <<a href="qbrush-h.html">qbrush.h</a>></code>
<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="#c6751a"><b>QBrush</b></a>()</div>
<li><div class="fn"><a href="#ca2e42"><b>QBrush</b></a>(BrushStyle)</div>
<li><div class="fn"><a href="#3979ba"><b>QBrush</b></a>(constQColor&, BrushStyle=SolidPattern)</div>
<li><div class="fn"><a href="#dca02c"><b>QBrush</b></a>(constQColor&, constQPixmap&)</div>
<li><div class="fn"><a href="#80da76"><b>QBrush</b></a>(constQBrush&)</div>
<li><div class="fn"><a href="#123e89"><b>~QBrush</b></a>()</div>
<li><div class="fn">QBrush&<a href="#fa09d4"><b>operator=</b></a>(constQBrush&)</div>
<li><div class="fn">BrushStyle<a href="#ae835f"><b>style</b></a>()const</div>
<li><div class="fn">void<a href="#4a5c6d"><b>setStyle</b></a>(BrushStyle)</div>
<li><div class="fn">constQColor&<a href="#2f5d95"><b>color</b></a>()const</div>
<li><div class="fn">void<a href="#fdde27"><b>setColor</b></a>(constQColor&)</div>
<li><div class="fn">QPixmap*<a href="#ee663b"><b>pixmap</b></a>()const</div>
<li><div class="fn">void<a href="#406414"><b>setPixmap</b></a>(constQPixmap&)</div>
<li><div class="fn">bool<a href="#181aed"><b>operator==</b></a>(constQBrush&p)const</div>
<li><div class="fn">bool<a href="#e939a3"><b>operator!=</b></a>(constQBrush&b)const</div>
</ul>
<h2>Related Functions</h2>
(Note that these are not member functions.)
<ul>
<li>QDataStream & <a href="qbrush.html#613538"><b>operator<<</b></a> (QDataStream & s, const QBrush & b)
<li>QDataStream & <a href="qbrush.html#906ff4"><b>operator>></b></a> (QDataStream & s, QBrush & b)
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QBrush class defines the fill pattern of shapes drawn by a <a href="qpainter.html">QPainter</a>.
<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 <code>NoBrush</code> (depends on how you construct a brush). This style tells the
painter to not fill shapes. The standard style for filling is called <code>SolidPattern.</code>
<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;
<a href="qbrush.html">QBrush</a> brush( yellow ); // yellow solid pattern
painter.<a href="qpainter.html#02ed5d">begin</a>( &anyPaintDevice ); // paint something
painter.<a href="qpainter.html#3e0cc8">setBrush</a>( brush ); // set the yellow brush
painter.<a href="qpainter.html#0183e4">setPen</a>( NoPen ); // do not draw outline
painter.<a href="qpainter.html#4c0077">drawRect</a>( 40,30, 200,100 ); // draw filled rectangle
painter.<a href="qpainter.html#3e0cc8">setBrush</a>( NoBrush ); // do not fill
painter.<a href="qpainter.html#0183e4">setPen</a>( black ); // set black pen, 0 pixel width
painter.<a href="qpainter.html#4c0077">drawRect</a>( 10,10, 30,20 ); // draw rectangle outline
painter.<a href="qpainter.html#365784">end</a>(); // painting done
</pre>
<p>See the <a href="#4a5c6d">setStyle</a>() function for a complete list of brush styles.
<p>See also <a href="qpainter.html">QPainter</a>, <a href="qpainter.html#3e0cc8">QPainter::setBrush</a>() and <a href="qpainter.html#f09597">QPainter::setBrushOrigin</a>().
<p>Examples:
<a href="drawdemo-drawdemo-cpp.html#QBrush">drawdemo/drawdemo.cpp</a>
<a href="picture-picture-cpp.html#QBrush">picture/picture.cpp</a>
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="c6751a"></a>QBrush::QBrush()</h3>
<p>Constructs a default black brush with the style <code>NoBrush</code> (will not fill
shapes).
<h3 class="fn"><a name="ca2e42"></a>QBrush::QBrush(BrushStylestyle)</h3>
<p>Constructs a black brush with the specified style.
<p>See also <a href="#4a5c6d">setStyle</a>().
<h3 class="fn"><a name="3979ba"></a>QBrush::QBrush(const<a href="qcolor.html">QColor</a>&color, BrushStylestyle=SolidPattern)</h3>
<p>Constructs a brush with a specified color and style.
<p>See also <a href="#fdde27">setColor</a>() and <a href="#4a5c6d">setStyle</a>().
<h3 class="fn"><a name="dca02c"></a>QBrush::QBrush(const<a href="qcolor.html">QColor</a>&color, const<a href="qpixmap.html">QPixmap</a>&pixmap)</h3>
<p>Constructs a brush with a specified color and a custom pattern.
<p>The color will only have an effect for monochrome pixmaps, i.e.
<a href="qpixmap.html#3c91c2">QPixmap::depth</a>() == 1.
<p>See also <a href="#fdde27">setColor</a>() and <a href="#406414">setPixmap</a>().
<h3 class="fn"><a name="80da76"></a>QBrush::QBrush(constQBrush&b)</h3>
<p>Constructs a brush which is a
<a href="shclass.html">shallow copy</a> of <em>b.</em>
<h3 class="fn"><a name="123e89"></a>QBrush::~QBrush()</h3>
<p>Destructs the brush.
<h3 class="fn">const<a href="qcolor.html">QColor</a>&<a name="2f5d95"></a>QBrush::color()const</h3>
<p>Returns the brush color.
<p>See also <a href="#fdde27">setColor</a>().
<h3 class="fn">bool<a name="e939a3"></a>QBrush::operator!=(constQBrush&b)const</h3>
<p>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>See also <a href="#181aed">operator==</a>().
<h3 class="fn">QBrush&<a name="fa09d4"></a>QBrush::operator=(constQBrush&b)</h3>
<p>Assigns <em>b</em> to this brush and returns a reference to this brush.
<h3 class="fn">bool<a name="181aed"></a>QBrush::operator==(constQBrush&b)const</h3>
<p>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>See also <a href="#e939a3">operator!=</a>().
<h3 class="fn"><a href="qpixmap.html">QPixmap</a>*<a name="ee663b"></a>QBrush::pixmap()const</h3>
<p>Returns a pointer to the custom brush pattern.
<p>A null pointer is returned if no custom brush pattern has been set.
<p>See also <a href="#406414">setPixmap</a>().
<h3 class="fn">void<a name="fdde27"></a>QBrush::setColor(const<a href="qcolor.html">QColor</a>&c)</h3>
<p>Sets the brush color to <em>c.</em>
<p>See also <a href="#2f5d95">color</a>() and <a href="#4a5c6d">setStyle</a>().
<p>Examples:
<a href="picture-picture-cpp.html#setColor">picture/picture.cpp</a>
<h3 class="fn">void<a name="406414"></a>QBrush::setPixmap(const<a href="qpixmap.html">QPixmap</a>&pixmap)</h3>
<p>Sets the brush pixmap. The style is set to <code>CustomPattern.</code>
<p>The current brush color will only have an effect for monochrome pixmaps,
i.e. <a href="qpixmap.html#3c91c2">QPixmap::depth</a>() == 1.
<p>See also <a href="#ee663b">pixmap</a>() and <a href="#2f5d95">color</a>().
<h3 class="fn">void<a name="4a5c6d"></a>QBrush::setStyle(BrushStyles)</h3>
<p>Sets the brush style to <em>s.</em>
<p>The brush styles are:
<ul>
<li> <code>NoBrush</code> will not fill shapes (default).
<li> <code>SolidPattern</code> solid (100%) fill pattern.
<li> <code>Dense1Pattern</code> 94% fill pattern.
<li> <code>Dense2Pattern</code> 88% fill pattern.
<li> <code>Dense3Pattern</code> 63% fill pattern.
<li> <code>Dense4Pattern</code> 50% fill pattern.
<li> <code>Dense5Pattern</code> 37% fill pattern.
<li> <code>Dense6Pattern</code> 12% fill pattern.
<li> <code>Dense7Pattern</code> 6% fill pattern.
<li> <code>HorPattern</code> horizontal lines pattern.
<li> <code>VerPattern</code> vertical lines pattern.
<li> <code>CrossPattern</code> crossing lines pattern.
<li> <code>BDiagPattern</code> diagonal lines (directed / ) pattern.
<li> <code>FDiagPattern</code> diagonal lines (directed \ ) pattern.
<li> <code>DiagCrossPattern</code> diagonal crossing lines pattern.
<li> <code>CustomPattern</code> set when a pixmap pattern is being used.
</ul>
<p>See also <a href="#ae835f">style</a>().
<h3 class="fn">BrushStyle<a name="ae835f"></a>QBrush::style()const</h3>
<p>Returns the brush style.
<p>See also <a href="#4a5c6d">setStyle</a>().
<hr><h2>Related Functions</h2>
<h3><a href="qdatastream.html">QDataStream</a> & <a name="613538"></a>operator<< (<a href="qdatastream.html">QDataStream</a> & s, const QBrush & b)</h3>
<p>Writes a brush to the stream and returns a reference to the stream.
<p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>
<h3><a href="qdatastream.html">QDataStream</a> & <a name="906ff4"></a>operator>> (<a href="qdatastream.html">QDataStream</a> & s, QBrush & b)</h3>
<p>Reads a brush from the stream and returns a reference to the stream.
<p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 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 2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>
|