Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > 1dd17e0d683ef79b4bb6872bbf359d7f > files > 6579

qt4-doc-4.8.7-26.2.mga7.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" />
<!-- qstylepainter.cpp -->
  <title>Qt 4.8: QStylePainter 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>QStylePainter</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="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QStylePainter Class Reference</h1>
<!-- $$$QStylePainter-brief -->
<p>The QStylePainter class is a convenience class for drawing <a href="qstyle.html">QStyle</a> elements inside a widget. <a href="#details">More...</a></p>
<!-- @@@QStylePainter -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QStylePainter&gt;</span></pre><p><b>Inherits: </b><a href="qpainter.html">QPainter</a>.</p>
<ul>
<li><a href="qstylepainter-members.html">List of all members, including inherited 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="qstylepainter.html#QStylePainter">QStylePainter</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstylepainter.html#QStylePainter-2">QStylePainter</a></b> ( QWidget * <i>widget</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstylepainter.html#QStylePainter-3">QStylePainter</a></b> ( QPaintDevice * <i>pd</i>, QWidget * <i>widget</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstylepainter.html#begin">begin</a></b> ( QWidget * <i>widget</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstylepainter.html#begin-2">begin</a></b> ( QPaintDevice * <i>pd</i>, QWidget * <i>widget</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstylepainter.html#drawComplexControl">drawComplexControl</a></b> ( QStyle::ComplexControl <i>cc</i>, const QStyleOptionComplex &amp; <i>option</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstylepainter.html#drawControl">drawControl</a></b> ( QStyle::ControlElement <i>ce</i>, const QStyleOption &amp; <i>option</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstylepainter.html#drawItemPixmap">drawItemPixmap</a></b> ( const QRect &amp; <i>rect</i>, int <i>flags</i>, const QPixmap &amp; <i>pixmap</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstylepainter.html#drawItemText">drawItemText</a></b> ( const QRect &amp; <i>rect</i>, int <i>flags</i>, const QPalette &amp; <i>pal</i>, bool <i>enabled</i>, const QString &amp; <i>text</i>, QPalette::ColorRole <i>textRole</i> = QPalette::NoRole )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstylepainter.html#drawPrimitive">drawPrimitive</a></b> ( QStyle::PrimitiveElement <i>pe</i>, const QStyleOption &amp; <i>option</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStyle * </td><td class="memItemRight bottomAlign"><b><a href="qstylepainter.html#style">style</a></b> () const</td></tr>
</table>
<ul>
<li class="fn">189 public functions inherited from <a href="qpainter.html#public-functions">QPainter</a></li>
</ul>
<a name="details"></a>
<!-- $$$QStylePainter-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QStylePainter class is a convenience class for drawing <a href="qstyle.html">QStyle</a> elements inside a widget.</p>
<p>QStylePainter extends <a href="qpainter.html">QPainter</a> with a set of high-level <tt>draw..&#x2e;()</tt> functions implemented on top of <a href="qstyle.html">QStyle</a>'s API. The advantage of using QStylePainter is that the parameter lists get considerably shorter. Whereas a <a href="qstyle.html">QStyle</a> object must be able to draw on any widget using any painter (because the application normally has one <a href="qstyle.html">QStyle</a> object shared by all widget), a QStylePainter is initialized with a widget, eliminating the need to specify the <a href="qwidget.html">QWidget</a>, the <a href="qpainter.html">QPainter</a>, and the <a href="qstyle.html">QStyle</a> for every function call.</p>
<p>Example using <a href="qstyle.html">QStyle</a> directly:</p>
<pre class="cpp"> <span class="type">void</span> MyWidget<span class="operator">::</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span> <span class="comment">/* event */</span>)
 {
     <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);

     <span class="type"><a href="qstyleoptionfocusrect.html">QStyleOptionFocusRect</a></span> option;
     option<span class="operator">.</span>initFrom(<span class="keyword">this</span>);
     option<span class="operator">.</span>backgroundColor <span class="operator">=</span> palette()<span class="operator">.</span>color(<span class="type"><a href="qpalette.html">QPalette</a></span><span class="operator">::</span>Background);

     style()<span class="operator">-</span><span class="operator">&gt;</span>drawPrimitive(<span class="type"><a href="qstyle.html">QStyle</a></span><span class="operator">::</span>PE_FrameFocusRect<span class="operator">,</span> <span class="operator">&amp;</span>option<span class="operator">,</span> <span class="operator">&amp;</span>painter<span class="operator">,</span> <span class="keyword">this</span>);
 }</pre>
<p>Example using QStylePainter:</p>
<pre class="cpp"> <span class="type">void</span> MyWidget<span class="operator">::</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span> <span class="comment">/* event */</span>)
 {
     <span class="type">QStylePainter</span> painter(<span class="keyword">this</span>);

     <span class="type"><a href="qstyleoptionfocusrect.html">QStyleOptionFocusRect</a></span> option;
     option<span class="operator">.</span>initFrom(<span class="keyword">this</span>);
     option<span class="operator">.</span>backgroundColor <span class="operator">=</span> palette()<span class="operator">.</span>color(<span class="type"><a href="qpalette.html">QPalette</a></span><span class="operator">::</span>Background);

     painter<span class="operator">.</span>drawPrimitive(<span class="type"><a href="qstyle.html">QStyle</a></span><span class="operator">::</span>PE_FrameFocusRect<span class="operator">,</span> option);
 }</pre>
</div>
<p><b>See also </b><a href="qstyle.html">QStyle</a> and <a href="qstyleoption.html">QStyleOption</a>.</p>
<!-- @@@QStylePainter -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QStylePainter[overload1]$$$QStylePainter -->
<h3 class="fn"><a name="QStylePainter"></a>QStylePainter::<span class="name">QStylePainter</span> ()</h3>
<p>Constructs a <a href="qstylepainter.html">QStylePainter</a>.</p>
<!-- @@@QStylePainter -->
<!-- $$$QStylePainter$$$QStylePainterQWidget* -->
<h3 class="fn"><a name="QStylePainter-2"></a>QStylePainter::<span class="name">QStylePainter</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>widget</i> )</h3>
<p>Construct a <a href="qstylepainter.html">QStylePainter</a> using widget <i>widget</i> for its paint device.</p>
<!-- @@@QStylePainter -->
<!-- $$$QStylePainter$$$QStylePainterQPaintDevice*QWidget* -->
<h3 class="fn"><a name="QStylePainter-3"></a>QStylePainter::<span class="name">QStylePainter</span> ( <span class="type"><a href="qpaintdevice.html">QPaintDevice</a></span> * <i>pd</i>, <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>widget</i> )</h3>
<p>Construct a <a href="qstylepainter.html">QStylePainter</a> using <i>pd</i> for its paint device, and attributes from <i>widget</i>.</p>
<!-- @@@QStylePainter -->
<!-- $$$begin[overload1]$$$beginQWidget* -->
<h3 class="fn"><a name="begin"></a><span class="type">bool</span> QStylePainter::<span class="name">begin</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>widget</i> )</h3>
<p>Begin painting operations on the specified <i>widget</i>. Returns true if the painter is ready to use; otherwise returns false.</p>
<p>This is automatically called by the constructor that takes a <a href="qwidget.html">QWidget</a>.</p>
<!-- @@@begin -->
<!-- $$$begin$$$beginQPaintDevice*QWidget* -->
<h3 class="fn"><a name="begin-2"></a><span class="type">bool</span> QStylePainter::<span class="name">begin</span> ( <span class="type"><a href="qpaintdevice.html">QPaintDevice</a></span> * <i>pd</i>, <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>widget</i> )</h3>
<p>This is an overloaded function.</p>
<p>Begin painting operations on paint device <i>pd</i> as if it was <i>widget</i>.</p>
<p>This is automatically called by the constructor that takes a <a href="qpaintdevice.html">QPaintDevice</a> and a <a href="qwidget.html">QWidget</a>.</p>
<!-- @@@begin -->
<!-- $$$drawComplexControl[overload1]$$$drawComplexControlQStyle::ComplexControlconstQStyleOptionComplex& -->
<h3 class="fn"><a name="drawComplexControl"></a><span class="type">void</span> QStylePainter::<span class="name">drawComplexControl</span> ( <span class="type"><a href="qstyle.html#ComplexControl-enum">QStyle::ComplexControl</a></span> <i>cc</i>, const <span class="type"><a href="qstyleoptioncomplex.html">QStyleOptionComplex</a></span> &amp; <i>option</i> )</h3>
<p>Use the widget's style to draw a complex control <i>cc</i> specified by the <a href="qstyleoptioncomplex.html">QStyleOptionComplex</a> <i>option</i>.</p>
<p><b>See also </b><a href="qstyle.html#drawComplexControl">QStyle::drawComplexControl</a>().</p>
<!-- @@@drawComplexControl -->
<!-- $$$drawControl[overload1]$$$drawControlQStyle::ControlElementconstQStyleOption& -->
<h3 class="fn"><a name="drawControl"></a><span class="type">void</span> QStylePainter::<span class="name">drawControl</span> ( <span class="type"><a href="qstyle.html#ControlElement-enum">QStyle::ControlElement</a></span> <i>ce</i>, const <span class="type"><a href="qstyleoption.html">QStyleOption</a></span> &amp; <i>option</i> )</h3>
<p>Use the widget's style to draw a control element <i>ce</i> specified by <a href="qstyleoption.html">QStyleOption</a> <i>option</i>.</p>
<p><b>See also </b><a href="qstyle.html#drawControl">QStyle::drawControl</a>().</p>
<!-- @@@drawControl -->
<!-- $$$drawItemPixmap[overload1]$$$drawItemPixmapconstQRect&intconstQPixmap& -->
<h3 class="fn"><a name="drawItemPixmap"></a><span class="type">void</span> QStylePainter::<span class="name">drawItemPixmap</span> ( const <span class="type"><a href="qrect.html">QRect</a></span> &amp; <i>rect</i>, <span class="type">int</span> <i>flags</i>, const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp; <i>pixmap</i> )</h3>
<p>Draws the <i>pixmap</i> in rectangle <i>rect</i>. The pixmap is aligned according to <i>flags</i>.</p>
<p><b>See also </b><a href="qstyle.html#drawItemPixmap">QStyle::drawItemPixmap</a>() and <a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a>.</p>
<!-- @@@drawItemPixmap -->
<!-- $$$drawItemText[overload1]$$$drawItemTextconstQRect&intconstQPalette&boolconstQString&QPalette::ColorRole -->
<h3 class="fn"><a name="drawItemText"></a><span class="type">void</span> QStylePainter::<span class="name">drawItemText</span> ( const <span class="type"><a href="qrect.html">QRect</a></span> &amp; <i>rect</i>, <span class="type">int</span> <i>flags</i>, const <span class="type"><a href="qpalette.html">QPalette</a></span> &amp; <i>pal</i>, <span class="type">bool</span> <i>enabled</i>, const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>text</i>, <span class="type"><a href="qpalette.html#ColorRole-enum">QPalette::ColorRole</a></span> <i>textRole</i> = QPalette::NoRole )</h3>
<p>Draws the <i>text</i> in rectangle <i>rect</i> and palette <i>pal</i>. The text is aligned and wrapped according to <i>flags</i>.</p>
<p>The pen color is specified with <i>textRole</i>. The <i>enabled</i> bool indicates whether or not the item is enabled; when reimplementing this bool should influence how the item is drawn.</p>
<p><b>See also </b><a href="qstyle.html#drawItemText">QStyle::drawItemText</a>() and <a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a>.</p>
<!-- @@@drawItemText -->
<!-- $$$drawPrimitive[overload1]$$$drawPrimitiveQStyle::PrimitiveElementconstQStyleOption& -->
<h3 class="fn"><a name="drawPrimitive"></a><span class="type">void</span> QStylePainter::<span class="name">drawPrimitive</span> ( <span class="type"><a href="qstyle.html#PrimitiveElement-enum">QStyle::PrimitiveElement</a></span> <i>pe</i>, const <span class="type"><a href="qstyleoption.html">QStyleOption</a></span> &amp; <i>option</i> )</h3>
<p>Use the widget's style to draw a primitive element <i>pe</i> specified by <a href="qstyleoption.html">QStyleOption</a> <i>option</i>.</p>
<p><b>See also </b><a href="qstyle.html#drawPrimitive">QStyle::drawPrimitive</a>().</p>
<!-- @@@drawPrimitive -->
<!-- $$$style[overload1]$$$style -->
<h3 class="fn"><a name="style"></a><span class="type"><a href="qstyle.html">QStyle</a></span> * QStylePainter::<span class="name">style</span> () const</h3>
<p>Return the current style used by the <a href="qstylepainter.html">QStylePainter</a>.</p>
<!-- @@@style -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2015 The Qt Company Ltd.
      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>
      Qt and respective logos are trademarks of The Qt Company Ltd 
      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>