Sophie

Sophie

distrib > Fedora > 18 > x86_64 > by-pkgid > ff187cb994c94c614ecc64c5a8528b1b > files > 4921

qt-doc-4.8.5-10.fc18.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qbrush.cpp -->
  <title>Qt 4.8: QBrush Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtgui.html">QtGui</a></li>
<li>QBrush</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#related-non-members">Related Non-Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QBrush Class Reference</h1>
<!-- $$$QBrush-brief -->
<p>The QBrush class defines the fill pattern of shapes drawn by <a href="qpainter.html">QPainter</a>. <a href="#details">More...</a></p>
<!-- @@@QBrush -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QBrush&gt;</span></pre><ul>
<li><a href="qbrush-members.html">List of all members, including inherited members</a></li>
<li><a href="qbrush-qt3.html">Qt 3 support members</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#QBrush">QBrush</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#QBrush-2">QBrush</a></b> ( Qt::BrushStyle <i>style</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#QBrush-3">QBrush</a></b> ( const QColor &amp; <i>color</i>, Qt::BrushStyle <i>style</i> = Qt::SolidPattern )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#QBrush-4">QBrush</a></b> ( Qt::GlobalColor <i>color</i>, Qt::BrushStyle <i>style</i> = Qt::SolidPattern )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#QBrush-5">QBrush</a></b> ( const QColor &amp; <i>color</i>, const QPixmap &amp; <i>pixmap</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#QBrush-6">QBrush</a></b> ( Qt::GlobalColor <i>color</i>, const QPixmap &amp; <i>pixmap</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#QBrush-7">QBrush</a></b> ( const QPixmap &amp; <i>pixmap</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#QBrush-8">QBrush</a></b> ( const QImage &amp; <i>image</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#QBrush-9">QBrush</a></b> ( const QBrush &amp; <i>other</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#QBrush-10">QBrush</a></b> ( const QGradient &amp; <i>gradient</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#dtor.QBrush">~QBrush</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QColor &amp; </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#color">color</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QGradient * </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#gradient">gradient</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#isOpaque">isOpaque</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QMatrix &amp; </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#matrix">matrix</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#setColor">setColor</a></b> ( const QColor &amp; <i>color</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#setColor-2">setColor</a></b> ( Qt::GlobalColor <i>color</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#setMatrix">setMatrix</a></b> ( const QMatrix &amp; <i>matrix</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#setStyle">setStyle</a></b> ( Qt::BrushStyle <i>style</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#setTexture">setTexture</a></b> ( const QPixmap &amp; <i>pixmap</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#setTextureImage">setTextureImage</a></b> ( const QImage &amp; <i>image</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#setTransform">setTransform</a></b> ( const QTransform &amp; <i>matrix</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::BrushStyle </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#style">style</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#swap">swap</a></b> ( QBrush &amp; <i>other</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPixmap </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#texture">texture</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QImage </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#textureImage">textureImage</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTransform </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#transform">transform</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#operator-QVariant">operator QVariant</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#operator-not-eq">operator!=</a></b> ( const QBrush &amp; <i>brush</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QBrush &amp; </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#operator-eq">operator=</a></b> ( const QBrush &amp; <i>brush</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#operator-eq-eq">operator==</a></b> ( const QBrush &amp; <i>brush</i> ) const</td></tr>
</table>
<a name="related-non-members"></a>
<h2>Related Non-Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp; </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#operator-lt-lt-153">operator&lt;&lt;</a></b> ( QDataStream &amp; <i>stream</i>, const QBrush &amp; <i>brush</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp; </td><td class="memItemRight bottomAlign"><b><a href="qbrush.html#operator-gt-gt-94">operator&gt;&gt;</a></b> ( QDataStream &amp; <i>stream</i>, QBrush &amp; <i>brush</i> )</td></tr>
</table>
<a name="details"></a>
<!-- $$$QBrush-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QBrush class defines the fill pattern of shapes drawn by <a href="qpainter.html">QPainter</a>.</p>
<p>A brush has a style, a color, a gradient and a texture.</p>
<p>The brush <a href="qbrush.html#style">style</a>() defines the fill pattern using the <a href="qt.html#BrushStyle-enum">Qt::BrushStyle</a> enum. The default brush style is <a href="qt.html#BrushStyle-enum">Qt::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">Qt::SolidPattern</a>. The style can be set when the brush is created using the appropriate constructor, and in addition the <a href="qbrush.html#setStyle">setStyle</a>() function provides means for altering the style once the brush is constructed.</p>
<p class="centerAlign"><img src="images/brush-styles.png" alt="Brush Styles" /></p><p>The brush <a href="qbrush.html#color">color</a>() defines the color of the fill pattern. The color can either be one of Qt's predefined colors, <a href="qt.html#GlobalColor-enum">Qt::GlobalColor</a>, or any other custom <a href="qcolor.html">QColor</a>. The currently set color can be retrieved and altered using the <a href="qbrush.html#color">color</a>() and <a href="qbrush.html#setColor">setColor</a>() functions, respectively.</p>
<p>The <a href="qbrush.html#gradient">gradient</a>() defines the gradient fill used when the current style is either <a href="qt.html#BrushStyle-enum">Qt::LinearGradientPattern</a>, <a href="qt.html#BrushStyle-enum">Qt::RadialGradientPattern</a> or <a href="qt.html#BrushStyle-enum">Qt::ConicalGradientPattern</a>. Gradient brushes are created by giving a <a href="qgradient.html">QGradient</a> as a constructor argument when creating the QBrush. Qt provides three different gradients: <a href="qlineargradient.html">QLinearGradient</a>, <a href="qconicalgradient.html">QConicalGradient</a>, and <a href="qradialgradient.html">QRadialGradient</a> - all of which inherit <a href="qgradient.html">QGradient</a>.</p>
<pre class="cpp">     <span class="type"><a href="qradialgradient.html">QRadialGradient</a></span> gradient(<span class="number">50</span><span class="operator">,</span> <span class="number">50</span><span class="operator">,</span> <span class="number">50</span><span class="operator">,</span> <span class="number">50</span><span class="operator">,</span> <span class="number">50</span>);
     gradient<span class="operator">.</span>setColorAt(<span class="number">0</span><span class="operator">,</span> <span class="type"><a href="qcolor.html">QColor</a></span><span class="operator">::</span>fromRgbF(<span class="number">0</span><span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span>));
     gradient<span class="operator">.</span>setColorAt(<span class="number">1</span><span class="operator">,</span> <span class="type"><a href="qcolor.html">QColor</a></span><span class="operator">::</span>fromRgbF(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span>));

     <span class="type">QBrush</span> brush(gradient);</pre>
<p>The <a href="qbrush.html#texture">texture</a>() defines the pixmap used when the current style is <a href="qt.html#BrushStyle-enum">Qt::TexturePattern</a>. You can create a brush with a texture by providing the pixmap when the brush is created or by using <a href="qbrush.html#setTexture">setTexture</a>().</p>
<p>Note that applying <a href="qbrush.html#setTexture">setTexture</a>() makes <a href="qbrush.html#style">style</a>() == <a href="qt.html#BrushStyle-enum">Qt::TexturePattern</a>, regardless of previous style settings. Also, calling <a href="qbrush.html#setColor">setColor</a>() will not make a difference if the style is a gradient. The same is the case if the style is <a href="qt.html#BrushStyle-enum">Qt::TexturePattern</a> style unless the current texture is a <a href="qbitmap.html">QBitmap</a>.</p>
<p>The <a href="qbrush.html#isOpaque">isOpaque</a>() function returns true if the brush is fully opaque otherwise false. A brush is considered opaque if:</p>
<ul>
<li>The alpha component of the <a href="qbrush.html#color">color</a>() is 255.</li>
<li>Its <a href="qbrush.html#texture">texture</a>() does not have an alpha channel and is not a <a href="qbitmap.html">QBitmap</a>.</li>
<li>The colors in the <a href="qbrush.html#gradient">gradient</a>() all have an alpha component that is 255.</li>
</ul>
<table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/brush-outline.png" alt="Outlines" /></td><td >To specify the style and color of lines and outlines, use the <a href="qpainter.html">QPainter</a>'s <a href="qpen.html">pen</a> combined with <a href="qt.html#PenStyle-enum">Qt::PenStyle</a> and <a href="qt.html#GlobalColor-enum">Qt::GlobalColor</a>:<pre class="cpp"> <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);

 painter<span class="operator">.</span>setBrush(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>cyan);
 painter<span class="operator">.</span>setPen(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>darkCyan);
 painter<span class="operator">.</span>drawRect(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">100</span><span class="operator">,</span><span class="number">100</span>);

 painter<span class="operator">.</span>setBrush(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>NoBrush);
 painter<span class="operator">.</span>setPen(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>darkGreen);
 painter<span class="operator">.</span>drawRect(<span class="number">40</span><span class="operator">,</span> <span class="number">40</span><span class="operator">,</span> <span class="number">100</span><span class="operator">,</span> <span class="number">100</span>);</pre>
<p>Note that, by default, <a href="qpainter.html">QPainter</a> renders the outline (using the currently set pen) when drawing shapes. Use <a href="qt.html#PenStyle-enum"><tt>painter.setPen(Qt::NoPen)</tt></a> to disable this behavior.</p>
</td></tr>
</table>
<p>For more information about painting in general, see the <a href="paintsystem.html">Paint System</a>.</p>
</div>
<p><b>See also </b><a href="qt.html#BrushStyle-enum">Qt::BrushStyle</a>, <a href="qpainter.html">QPainter</a>, and <a href="qcolor.html">QColor</a>.</p>
<!-- @@@QBrush -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QBrush[overload1]$$$QBrush -->
<h3 class="fn"><a name="QBrush"></a>QBrush::<span class="name">QBrush</span> ()</h3>
<p>Constructs a default black brush with the style <a href="qt.html#BrushStyle-enum">Qt::NoBrush</a> (i.e&#x2e; this brush will not fill shapes).</p>
<!-- @@@QBrush -->
<!-- $$$QBrush$$$QBrushQt::BrushStyle -->
<h3 class="fn"><a name="QBrush-2"></a>QBrush::<span class="name">QBrush</span> ( <span class="type"><a href="qt.html#BrushStyle-enum">Qt::BrushStyle</a></span> <i>style</i> )</h3>
<p>Constructs a black brush with the given <i>style</i>.</p>
<p><b>See also </b><a href="qbrush.html#setStyle">setStyle</a>().</p>
<!-- @@@QBrush -->
<!-- $$$QBrush$$$QBrushconstQColor&Qt::BrushStyle -->
<h3 class="fn"><a name="QBrush-3"></a>QBrush::<span class="name">QBrush</span> ( const <span class="type"><a href="qcolor.html">QColor</a></span> &amp; <i>color</i>, <span class="type"><a href="qt.html#BrushStyle-enum">Qt::BrushStyle</a></span> <i>style</i> = Qt::SolidPattern )</h3>
<p>Constructs a brush with the given <i>color</i> and <i>style</i>.</p>
<p><b>See also </b><a href="qbrush.html#setColor">setColor</a>() and <a href="qbrush.html#setStyle">setStyle</a>().</p>
<!-- @@@QBrush -->
<!-- $$$QBrush$$$QBrushQt::GlobalColorQt::BrushStyle -->
<h3 class="fn"><a name="QBrush-4"></a>QBrush::<span class="name">QBrush</span> ( <span class="type"><a href="qt.html#GlobalColor-enum">Qt::GlobalColor</a></span> <i>color</i>, <span class="type"><a href="qt.html#BrushStyle-enum">Qt::BrushStyle</a></span> <i>style</i> = Qt::SolidPattern )</h3>
<p>Constructs a brush with the given <i>color</i> and <i>style</i>.</p>
<p><b>See also </b><a href="qbrush.html#setColor">setColor</a>() and <a href="qbrush.html#setStyle">setStyle</a>().</p>
<!-- @@@QBrush -->
<!-- $$$QBrush$$$QBrushconstQColor&constQPixmap& -->
<h3 class="fn"><a name="QBrush-5"></a>QBrush::<span class="name">QBrush</span> ( const <span class="type"><a href="qcolor.html">QColor</a></span> &amp; <i>color</i>, const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp; <i>pixmap</i> )</h3>
<p>Constructs a brush with the given <i>color</i> and the custom pattern stored in <i>pixmap</i>.</p>
<p>The style is set to <a href="qt.html#BrushStyle-enum">Qt::TexturePattern</a>. The color will only have an effect for QBitmaps.</p>
<p><b>See also </b><a href="qbrush.html#setColor">setColor</a>() and <a href="qbrush-qt3.html#setPixmap" class="compat">setPixmap</a>().</p>
<!-- @@@QBrush -->
<!-- $$$QBrush$$$QBrushQt::GlobalColorconstQPixmap& -->
<h3 class="fn"><a name="QBrush-6"></a>QBrush::<span class="name">QBrush</span> ( <span class="type"><a href="qt.html#GlobalColor-enum">Qt::GlobalColor</a></span> <i>color</i>, const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp; <i>pixmap</i> )</h3>
<p>Constructs a brush with the given <i>color</i> and the custom pattern stored in <i>pixmap</i>.</p>
<p>The style is set to <a href="qt.html#BrushStyle-enum">Qt::TexturePattern</a>. The color will only have an effect for QBitmaps.</p>
<p><b>See also </b><a href="qbrush.html#setColor">setColor</a>() and <a href="qbrush-qt3.html#setPixmap" class="compat">setPixmap</a>().</p>
<!-- @@@QBrush -->
<!-- $$$QBrush$$$QBrushconstQPixmap& -->
<h3 class="fn"><a name="QBrush-7"></a>QBrush::<span class="name">QBrush</span> ( const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp; <i>pixmap</i> )</h3>
<p>Constructs a brush with a black color and a texture set to the given <i>pixmap</i>. The style is set to <a href="qt.html#BrushStyle-enum">Qt::TexturePattern</a>.</p>
<p><b>See also </b><a href="qbrush.html#setTexture">setTexture</a>().</p>
<!-- @@@QBrush -->
<!-- $$$QBrush$$$QBrushconstQImage& -->
<h3 class="fn"><a name="QBrush-8"></a>QBrush::<span class="name">QBrush</span> ( const <span class="type"><a href="qimage.html">QImage</a></span> &amp; <i>image</i> )</h3>
<p>Constructs a brush with a black color and a texture set to the given <i>image</i>. The style is set to <a href="qt.html#BrushStyle-enum">Qt::TexturePattern</a>.</p>
<p><b>See also </b><a href="qbrush.html#setTextureImage">setTextureImage</a>().</p>
<!-- @@@QBrush -->
<!-- $$$QBrush$$$QBrushconstQBrush& -->
<h3 class="fn"><a name="QBrush-9"></a>QBrush::<span class="name">QBrush</span> ( const <span class="type">QBrush</span> &amp; <i>other</i> )</h3>
<p>Constructs a copy of <i>other</i>.</p>
<!-- @@@QBrush -->
<!-- $$$QBrush$$$QBrushconstQGradient& -->
<h3 class="fn"><a name="QBrush-10"></a>QBrush::<span class="name">QBrush</span> ( const <span class="type"><a href="qgradient.html">QGradient</a></span> &amp; <i>gradient</i> )</h3>
<p>Constructs a brush based on the given <i>gradient</i>.</p>
<p>The brush style is set to the corresponding gradient style (either <a href="qt.html#BrushStyle-enum">Qt::LinearGradientPattern</a>, <a href="qt.html#BrushStyle-enum">Qt::RadialGradientPattern</a> or <a href="qt.html#BrushStyle-enum">Qt::ConicalGradientPattern</a>).</p>
<!-- @@@QBrush -->
<!-- $$$~QBrush[overload1]$$$~QBrush -->
<h3 class="fn"><a name="dtor.QBrush"></a>QBrush::<span class="name">~QBrush</span> ()</h3>
<p>Destroys the brush.</p>
<!-- @@@~QBrush -->
<!-- $$$color[overload1]$$$color -->
<h3 class="fn"><a name="color"></a>const <span class="type"><a href="qcolor.html">QColor</a></span> &amp; QBrush::<span class="name">color</span> () const</h3>
<p>Returns the brush color.</p>
<p><b>See also </b><a href="qbrush.html#setColor">setColor</a>().</p>
<!-- @@@color -->
<!-- $$$gradient[overload1]$$$gradient -->
<h3 class="fn"><a name="gradient"></a>const <span class="type"><a href="qgradient.html">QGradient</a></span> * QBrush::<span class="name">gradient</span> () const</h3>
<p>Returns the gradient describing this brush.</p>
<!-- @@@gradient -->
<!-- $$$isOpaque[overload1]$$$isOpaque -->
<h3 class="fn"><a name="isOpaque"></a><span class="type">bool</span> QBrush::<span class="name">isOpaque</span> () const</h3>
<p>Returns true if the brush is fully opaque otherwise false. A brush is considered opaque if:</p>
<ul>
<li>The alpha component of the <a href="qbrush.html#color">color</a>() is 255.</li>
<li>Its <a href="qbrush.html#texture">texture</a>() does not have an alpha channel and is not a <a href="qbitmap.html">QBitmap</a>.</li>
<li>The colors in the <a href="qbrush.html#gradient">gradient</a>() all have an alpha component that is 255.</li>
<li>It is an extended radial gradient.</li>
</ul>
<!-- @@@isOpaque -->
<!-- $$$matrix[overload1]$$$matrix -->
<h3 class="fn"><a name="matrix"></a>const <span class="type"><a href="qmatrix.html">QMatrix</a></span> &amp; QBrush::<span class="name">matrix</span> () const</h3>
<p>Returns the current transformation matrix for the brush.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qbrush.html#setMatrix">setMatrix</a>().</p>
<!-- @@@matrix -->
<!-- $$$setColor[overload1]$$$setColorconstQColor& -->
<h3 class="fn"><a name="setColor"></a><span class="type">void</span> QBrush::<span class="name">setColor</span> ( const <span class="type"><a href="qcolor.html">QColor</a></span> &amp; <i>color</i> )</h3>
<p>Sets the brush color to the given <i>color</i>.</p>
<p>Note that calling setColor() will not make a difference if the style is a gradient. The same is the case if the style is <a href="qt.html#BrushStyle-enum">Qt::TexturePattern</a> style unless the current texture is a <a href="qbitmap.html">QBitmap</a>.</p>
<p><b>See also </b><a href="qbrush.html#color">color</a>().</p>
<!-- @@@setColor -->
<!-- $$$setColor$$$setColorQt::GlobalColor -->
<h3 class="fn"><a name="setColor-2"></a><span class="type">void</span> QBrush::<span class="name">setColor</span> ( <span class="type"><a href="qt.html#GlobalColor-enum">Qt::GlobalColor</a></span> <i>color</i> )</h3>
<p>This is an overloaded function.</p>
<p>Sets the brush color to the given <i>color</i>.</p>
<!-- @@@setColor -->
<!-- $$$setMatrix[overload1]$$$setMatrixconstQMatrix& -->
<h3 class="fn"><a name="setMatrix"></a><span class="type">void</span> QBrush::<span class="name">setMatrix</span> ( const <span class="type"><a href="qmatrix.html">QMatrix</a></span> &amp; <i>matrix</i> )</h3>
<p>Sets <i>matrix</i> as an explicit transformation matrix on the current brush. The brush transformation matrix is merged with <a href="qpainter.html">QPainter</a> transformation matrix to produce the final result.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qbrush.html#matrix">matrix</a>().</p>
<!-- @@@setMatrix -->
<!-- $$$setStyle[overload1]$$$setStyleQt::BrushStyle -->
<h3 class="fn"><a name="setStyle"></a><span class="type">void</span> QBrush::<span class="name">setStyle</span> ( <span class="type"><a href="qt.html#BrushStyle-enum">Qt::BrushStyle</a></span> <i>style</i> )</h3>
<p>Sets the brush style to <i>style</i>.</p>
<p><b>See also </b><a href="qbrush.html#style">style</a>().</p>
<!-- @@@setStyle -->
<!-- $$$setTexture[overload1]$$$setTextureconstQPixmap& -->
<h3 class="fn"><a name="setTexture"></a><span class="type">void</span> QBrush::<span class="name">setTexture</span> ( const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp; <i>pixmap</i> )</h3>
<p>Sets the brush pixmap to <i>pixmap</i>. The style is set to <a href="qt.html#BrushStyle-enum">Qt::TexturePattern</a>.</p>
<p>The current brush color will only have an effect for monochrome pixmaps, i.e&#x2e; for <a href="qpixmap.html#depth">QPixmap::depth</a>() == 1 (<a href="qbitmap.html">QBitmaps</a>).</p>
<p><b>See also </b><a href="qbrush.html#texture">texture</a>().</p>
<!-- @@@setTexture -->
<!-- $$$setTextureImage[overload1]$$$setTextureImageconstQImage& -->
<h3 class="fn"><a name="setTextureImage"></a><span class="type">void</span> QBrush::<span class="name">setTextureImage</span> ( const <span class="type"><a href="qimage.html">QImage</a></span> &amp; <i>image</i> )</h3>
<p>Sets the brush image to <i>image</i>. The style is set to <a href="qt.html#BrushStyle-enum">Qt::TexturePattern</a>.</p>
<p>Note the current brush color will <i>not</i> have any affect on monochrome images, as opposed to calling <a href="qbrush.html#setTexture">setTexture</a>() with a <a href="qbitmap.html">QBitmap</a>. If you want to change the color of monochrome image brushes, either convert the image to <a href="qbitmap.html">QBitmap</a> with <tt>QBitmap::fromImage()</tt> and set the resulting <a href="qbitmap.html">QBitmap</a> as a texture, or change the entries in the color table for the image.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qbrush.html#textureImage">textureImage</a>() and <a href="qbrush.html#setTexture">setTexture</a>().</p>
<!-- @@@setTextureImage -->
<!-- $$$setTransform[overload1]$$$setTransformconstQTransform& -->
<h3 class="fn"><a name="setTransform"></a><span class="type">void</span> QBrush::<span class="name">setTransform</span> ( const <span class="type"><a href="qtransform.html">QTransform</a></span> &amp; <i>matrix</i> )</h3>
<p>Sets <i>matrix</i> as an explicit transformation matrix on the current brush. The brush transformation matrix is merged with <a href="qpainter.html">QPainter</a> transformation matrix to produce the final result.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also </b><a href="qbrush.html#transform">transform</a>().</p>
<!-- @@@setTransform -->
<!-- $$$style[overload1]$$$style -->
<h3 class="fn"><a name="style"></a><span class="type"><a href="qt.html#BrushStyle-enum">Qt::BrushStyle</a></span> QBrush::<span class="name">style</span> () const</h3>
<p>Returns the brush style.</p>
<p><b>See also </b><a href="qbrush.html#setStyle">setStyle</a>().</p>
<!-- @@@style -->
<!-- $$$swap[overload1]$$$swapQBrush& -->
<h3 class="fn"><a name="swap"></a><span class="type">void</span> QBrush::<span class="name">swap</span> ( <span class="type">QBrush</span> &amp; <i>other</i> )</h3>
<p>Swaps brush <i>other</i> with this brush. This operation is very fast and never fails.</p>
<p>This function was introduced in Qt 4.8.</p>
<!-- @@@swap -->
<!-- $$$texture[overload1]$$$texture -->
<h3 class="fn"><a name="texture"></a><span class="type"><a href="qpixmap.html">QPixmap</a></span> QBrush::<span class="name">texture</span> () const</h3>
<p>Returns the custom brush pattern, or a null pixmap if no custom brush pattern has been set.</p>
<p><b>See also </b><a href="qbrush.html#setTexture">setTexture</a>().</p>
<!-- @@@texture -->
<!-- $$$textureImage[overload1]$$$textureImage -->
<h3 class="fn"><a name="textureImage"></a><span class="type"><a href="qimage.html">QImage</a></span> QBrush::<span class="name">textureImage</span> () const</h3>
<p>Returns the custom brush pattern, or a null image if no custom brush pattern has been set.</p>
<p>If the texture was set as a <a href="qpixmap.html">QPixmap</a> it will be converted to a <a href="qimage.html">QImage</a>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qbrush.html#setTextureImage">setTextureImage</a>().</p>
<!-- @@@textureImage -->
<!-- $$$transform[overload1]$$$transform -->
<h3 class="fn"><a name="transform"></a><span class="type"><a href="qtransform.html">QTransform</a></span> QBrush::<span class="name">transform</span> () const</h3>
<p>Returns the current transformation matrix for the brush.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also </b><a href="qbrush.html#setTransform">setTransform</a>().</p>
<!-- @@@transform -->
<!-- $$$operator QVariant[overload1]$$$operator QVariant -->
<h3 class="fn"><a name="operator-QVariant"></a>QBrush::<span class="name">operator QVariant</span> () const</h3>
<p>Returns the brush as a <a href="qvariant.html">QVariant</a></p>
<!-- @@@operator QVariant -->
<!-- $$$operator!=[overload1]$$$operator!=constQBrush& -->
<h3 class="fn"><a name="operator-not-eq"></a><span class="type">bool</span> QBrush::<span class="name">operator!=</span> ( const <span class="type">QBrush</span> &amp; <i>brush</i> ) const</h3>
<p>Returns true if the brush is different from the given <i>brush</i>; otherwise returns false.</p>
<p>Two brushes are different if they have different styles, colors or transforms or different pixmaps or gradients depending on the style.</p>
<p><b>See also </b><a href="qbrush.html#operator-eq-eq">operator==</a>().</p>
<!-- @@@operator!= -->
<!-- $$$operator=[overload1]$$$operator=constQBrush& -->
<h3 class="fn"><a name="operator-eq"></a><span class="type">QBrush</span> &amp; QBrush::<span class="name">operator=</span> ( const <span class="type">QBrush</span> &amp; <i>brush</i> )</h3>
<p>Assigns the given <i>brush</i> to <i>this</i> brush and returns a reference to <i>this</i> brush.</p>
<!-- @@@operator= -->
<!-- $$$operator==[overload1]$$$operator==constQBrush& -->
<h3 class="fn"><a name="operator-eq-eq"></a><span class="type">bool</span> QBrush::<span class="name">operator==</span> ( const <span class="type">QBrush</span> &amp; <i>brush</i> ) const</h3>
<p>Returns true if the brush is equal to the given <i>brush</i>; otherwise returns false.</p>
<p>Two brushes are equal if they have equal styles, colors and transforms and equal pixmaps or gradients depending on the style.</p>
<p><b>See also </b><a href="qbrush.html#operator-not-eq">operator!=</a>().</p>
<!-- @@@operator== -->
</div>
<div class="relnonmem">
<h2>Related Non-Members</h2>
<!-- $$$operator<<$$$operator<<QDataStream&constQBrush& -->
<h3 class="fn"><a name="operator-lt-lt-153"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <span class="name">operator&lt;&lt;</span> ( <span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <i>stream</i>, const <span class="type">QBrush</span> &amp; <i>brush</i> )</h3>
<p>Writes the given <i>brush</i> to the given <i>stream</i> and returns a reference to the <i>stream</i>.</p>
<p><b>See also </b><a href="datastreamformat.html">Serializing Qt Data Types</a>.</p>
<!-- @@@operator<< -->
<!-- $$$operator>>$$$operator>>QDataStream&QBrush& -->
<h3 class="fn"><a name="operator-gt-gt-94"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <span class="name">operator&gt;&gt;</span> ( <span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <i>stream</i>, <span class="type">QBrush</span> &amp; <i>brush</i> )</h3>
<p>Reads the given <i>brush</i> from the given <i>stream</i> and returns a reference to the <i>stream</i>.</p>
<p><b>See also </b><a href="datastreamformat.html">Serializing Qt Data Types</a>.</p>
<!-- @@@operator>> -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2013 Digia Plc and/or its
      subsidiaries. Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Digia, Qt and their respective logos are trademarks of Digia Plc 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
  </div>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>