Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 1dd17e0d683ef79b4bb6872bbf359d7f > files > 5727

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" />
<!-- qmatrix.cpp -->
  <title>Qt 4.8: QMatrix 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>QMatrix</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>
<li class="level2"><a href="#rendering-graphics">Rendering Graphics</a></li>
<li class="level2"><a href="#basic-matrix-operations">Basic Matrix Operations</a></li>
</ul>
</div>
<h1 class="title">QMatrix Class Reference</h1>
<!-- $$$QMatrix-brief -->
<p>The QMatrix class specifies 2D transformations of a coordinate system. <a href="#details">More...</a></p>
<!-- @@@QMatrix -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QMatrix&gt;</span></pre><p><b>This class is obsolete.</b> It is provided to keep old source code working. We strongly advise against using it in new code.</p>
<ul>
<li><a href="qmatrix-members.html">List of all members, including inherited members</a></li>
<li><a href="qmatrix-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="qmatrix.html#QMatrix">QMatrix</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#QMatrix-3">QMatrix</a></b> ( qreal <i>m11</i>, qreal <i>m12</i>, qreal <i>m21</i>, qreal <i>m22</i>, qreal <i>dx</i>, qreal <i>dy</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#QMatrix-4">QMatrix</a></b> ( const QMatrix &amp; <i>matrix</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#m11">m11</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#m12">m12</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#m21">m21</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#m22">m22</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#determinant">determinant</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#dx">dx</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#dy">dy</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMatrix </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#inverted">inverted</a></b> ( bool * <i>invertible</i> = 0 ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#isIdentity">isIdentity</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#isInvertible">isInvertible</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#map">map</a></b> ( qreal <i>x</i>, qreal <i>y</i>, qreal * <i>tx</i>, qreal * <i>ty</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#map-3">map</a></b> ( int <i>x</i>, int <i>y</i>, int * <i>tx</i>, int * <i>ty</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPointF </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#map-4">map</a></b> ( const QPointF &amp; <i>point</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPoint </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#map-5">map</a></b> ( const QPoint &amp; <i>point</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QLineF </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#map-6">map</a></b> ( const QLineF &amp; <i>line</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QLine </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#map-7">map</a></b> ( const QLine &amp; <i>line</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPolygonF </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#map-8">map</a></b> ( const QPolygonF &amp; <i>polygon</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPolygon </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#map-9">map</a></b> ( const QPolygon &amp; <i>polygon</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRegion </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#map-10">map</a></b> ( const QRegion &amp; <i>region</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPainterPath </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#map-11">map</a></b> ( const QPainterPath &amp; <i>path</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRectF </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#mapRect">mapRect</a></b> ( const QRectF &amp; <i>rectangle</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#mapRect-2">mapRect</a></b> ( const QRect &amp; <i>rectangle</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPolygon </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#mapToPolygon">mapToPolygon</a></b> ( const QRect &amp; <i>rectangle</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#reset">reset</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMatrix &amp; </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#rotate">rotate</a></b> ( qreal <i>degrees</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMatrix &amp; </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#scale">scale</a></b> ( qreal <i>sx</i>, qreal <i>sy</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#setMatrix">setMatrix</a></b> ( qreal <i>m11</i>, qreal <i>m12</i>, qreal <i>m21</i>, qreal <i>m22</i>, qreal <i>dx</i>, qreal <i>dy</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMatrix &amp; </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#shear">shear</a></b> ( qreal <i>sh</i>, qreal <i>sv</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMatrix &amp; </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#translate">translate</a></b> ( qreal <i>dx</i>, qreal <i>dy</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.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="qmatrix.html#operator-not-eq">operator!=</a></b> ( const QMatrix &amp; <i>matrix</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMatrix </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#operator-2a">operator*</a></b> ( const QMatrix &amp; <i>matrix</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMatrix &amp; </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#operator-2a-eq">operator*=</a></b> ( const QMatrix &amp; <i>matrix</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMatrix &amp; </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#operator-eq">operator=</a></b> ( const QMatrix &amp; <i>matrix</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#operator-eq-eq">operator==</a></b> ( const QMatrix &amp; <i>matrix</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"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#qFuzzyCompare-3">qFuzzyCompare</a></b> ( const QMatrix &amp; <i>m1</i>, const QMatrix &amp; <i>m2</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPoint </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#operator-2a-15">operator*</a></b> ( const QPoint &amp; <i>point</i>, const QMatrix &amp; <i>matrix</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPointF </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#operator-2a-16">operator*</a></b> ( const QPointF &amp; <i>point</i>, const QMatrix &amp; <i>matrix</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QLineF </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#operator-2a-17">operator*</a></b> ( const QLineF &amp; <i>line</i>, const QMatrix &amp; <i>matrix</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QLine </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#operator-2a-18">operator*</a></b> ( const QLine &amp; <i>line</i>, const QMatrix &amp; <i>matrix</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPolygon </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#operator-2a-19">operator*</a></b> ( const QPolygon &amp; <i>polygon</i>, const QMatrix &amp; <i>matrix</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPolygonF </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#operator-2a-20">operator*</a></b> ( const QPolygonF &amp; <i>polygon</i>, const QMatrix &amp; <i>matrix</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRegion </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#operator-2a-21">operator*</a></b> ( const QRegion &amp; <i>region</i>, const QMatrix &amp; <i>matrix</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPainterPath </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#operator-2a-22">operator*</a></b> ( const QPainterPath &amp; <i>path</i>, const QMatrix &amp; <i>matrix</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp; </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#operator-lt-lt-27">operator&lt;&lt;</a></b> ( QDataStream &amp; <i>stream</i>, const QMatrix &amp; <i>matrix</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp; </td><td class="memItemRight bottomAlign"><b><a href="qmatrix.html#operator-gt-gt-17">operator&gt;&gt;</a></b> ( QDataStream &amp; <i>stream</i>, QMatrix &amp; <i>matrix</i> )</td></tr>
</table>
<a name="details"></a>
<!-- $$$QMatrix-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QMatrix class specifies 2D transformations of a coordinate system.</p>
<p>A matrix specifies how to translate, scale, shear or rotate the coordinate system, and is typically used when rendering graphics. QMatrix, in contrast to <a href="qtransform.html">QTransform</a>, does not allow perspective transformations. <a href="qtransform.html">QTransform</a> is the recommended transformation class in Qt.</p>
<p>A QMatrix object can be built using the <a href="qmatrix.html#setMatrix">setMatrix</a>(), <a href="qmatrix.html#scale">scale</a>(), <a href="qmatrix.html#rotate">rotate</a>(), <a href="qmatrix.html#translate">translate</a>() and <a href="qmatrix.html#shear">shear</a>() functions. Alternatively, it can be built by applying <a href="#basic-matrix-operations">basic matrix operations</a>. The matrix can also be defined when constructed, and it can be reset to the identity matrix (the default) using the <a href="qmatrix.html#reset">reset</a>() function.</p>
<p>The QMatrix class supports mapping of graphic primitives: A given point, line, polygon, region, or painter path can be mapped to the coordinate system defined by <i>this</i> matrix using the <a href="qmatrix.html#map">map</a>() function. In case of a rectangle, its coordinates can be transformed using the <a href="qmatrix.html#mapRect">mapRect</a>() function. A rectangle can also be transformed into a <i>polygon</i> (mapped to the coordinate system defined by <i>this</i> matrix), using the <a href="qmatrix.html#mapToPolygon">mapToPolygon</a>() function.</p>
<p>QMatrix provides the <a href="qmatrix.html#isIdentity">isIdentity</a>() function which returns true if the matrix is the identity matrix, and the <a href="qmatrix.html#isInvertible">isInvertible</a>() function which returns true if the matrix is non-singular (i.e&#x2e; AB = BA = I). The <a href="qmatrix.html#inverted">inverted</a>() function returns an inverted copy of <i>this</i> matrix if it is invertible (otherwise it returns the identity matrix). In addition, QMatrix provides the <a href="qmatrix.html#determinant">determinant</a>() function returning the matrix's determinant.</p>
<p>Finally, the QMatrix class supports matrix multiplication, and objects of the class can be streamed as well as compared.</p>
<a name="rendering-graphics"></a>
<h3>Rendering Graphics</h3>
<p>When rendering graphics, the matrix defines the transformations but the actual transformation is performed by the drawing routines in <a href="qpainter.html">QPainter</a>.</p>
<p>By default, <a href="qpainter.html">QPainter</a> operates on the associated device's own coordinate system. The standard coordinate system of a <a href="qpaintdevice.html">QPaintDevice</a> has its origin located at the top-left position. The <i>x</i> values increase to the right; <i>y</i> values increase downward. For a complete description, see the <a href="coordsys.html">coordinate system</a> documentation.</p>
<p><a href="qpainter.html">QPainter</a> has functions to translate, scale, shear and rotate the coordinate system without using a QMatrix. For example:</p>
<table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qmatrix-simpletransformation.png" alt="" /></td><td ><pre class="cpp"> <span class="type">void</span> SimpleTransformation<span class="operator">::</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
 {
     <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
     painter<span class="operator">.</span>setPen(<span class="type"><a href="qpen.html">QPen</a></span>(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>blue<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>DashLine));
     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>rotate(<span class="number">45</span>);

     painter<span class="operator">.</span>setFont(<span class="type"><a href="qfont.html">QFont</a></span>(<span class="string">&quot;Helvetica&quot;</span><span class="operator">,</span> <span class="number">24</span>));
     painter<span class="operator">.</span>setPen(<span class="type"><a href="qpen.html">QPen</a></span>(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>black<span class="operator">,</span> <span class="number">1</span>));
     painter<span class="operator">.</span>drawText(<span class="number">20</span><span class="operator">,</span> <span class="number">10</span><span class="operator">,</span> <span class="string">&quot;QMatrix&quot;</span>);
 }</pre>
</td></tr>
</table>
<p>Although these functions are very convenient, it can be more efficient to build a QMatrix and call <a href="qpainter-obsolete.html#setMatrix">QPainter::setMatrix</a>() if you want to perform more than a single transform operation. For example:</p>
<table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qmatrix-combinedtransformation.png" alt="" /></td><td ><pre class="cpp"> <span class="type">void</span> CombinedTransformation<span class="operator">::</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
 {
     <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
     painter<span class="operator">.</span>setPen(<span class="type"><a href="qpen.html">QPen</a></span>(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>blue<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>DashLine));
     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>);

     <span class="type">QMatrix</span> matrix;
     matrix<span class="operator">.</span>translate(<span class="number">50</span><span class="operator">,</span> <span class="number">50</span>);
     matrix<span class="operator">.</span>rotate(<span class="number">45</span>);
     matrix<span class="operator">.</span>scale(<span class="number">0.5</span><span class="operator">,</span> <span class="number">1.0</span>);
     painter<span class="operator">.</span>setMatrix(matrix);

     painter<span class="operator">.</span>setFont(<span class="type"><a href="qfont.html">QFont</a></span>(<span class="string">&quot;Helvetica&quot;</span><span class="operator">,</span> <span class="number">24</span>));
     painter<span class="operator">.</span>setPen(<span class="type"><a href="qpen.html">QPen</a></span>(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>black<span class="operator">,</span> <span class="number">1</span>));
     painter<span class="operator">.</span>drawText(<span class="number">20</span><span class="operator">,</span> <span class="number">10</span><span class="operator">,</span> <span class="string">&quot;QMatrix&quot;</span>);
 }</pre>
</td></tr>
</table>
<a name="basic-matrix-operations"></a>
<h3>Basic Matrix Operations</h3>
<p class="centerAlign"><img src="images/qmatrix-representation.png" alt="" /></p><p>A QMatrix object contains a 3 x 3 matrix. The <tt>dx</tt> and <tt>dy</tt> elements specify horizontal and vertical translation. The <tt>m11</tt> and <tt>m22</tt> elements specify horizontal and vertical scaling. And finally, the <tt>m21</tt> and <tt>m12</tt> elements specify horizontal and vertical <i>shearing</i>.</p>
<p>QMatrix transforms a point in the plane to another point using the following formulas:</p>
<pre class="cpp"> x<span class="char">' = m11*x + m21*y + dx
 y'</span> <span class="operator">=</span> m22<span class="operator">*</span>y <span class="operator">+</span> m12<span class="operator">*</span>x <span class="operator">+</span> dy</pre>
<p>The point <i>(x, y)</i> is the original point, and <i>(x', y')</i> is the transformed point. <i>(x', y')</i> can be transformed back to <i>(x, y)</i> by performing the same operation on the <a href="qmatrix.html#inverted">inverted</a>() matrix.</p>
<p>The various matrix elements can be set when constructing the matrix, or by using the <a href="qmatrix.html#setMatrix">setMatrix</a>() function later on. They can also be manipulated using the <a href="qmatrix.html#translate">translate</a>(), <a href="qmatrix.html#rotate">rotate</a>(), <a href="qmatrix.html#scale">scale</a>() and <a href="qmatrix.html#shear">shear</a>() convenience functions, The currently set values can be retrieved using the <a href="qmatrix.html#m11">m11</a>(), <a href="qmatrix.html#m12">m12</a>(), <a href="qmatrix.html#m21">m21</a>(), <a href="qmatrix.html#m22">m22</a>(), <a href="qmatrix.html#dx">dx</a>() and <a href="qmatrix.html#dy">dy</a>() functions.</p>
<p>Translation is the simplest transformation. Setting <tt>dx</tt> and <tt>dy</tt> will move the coordinate system <tt>dx</tt> units along the X axis and <tt>dy</tt> units along the Y axis. Scaling can be done by setting <tt>m11</tt> and <tt>m22</tt>. For example, setting <tt>m11</tt> to 2 and <tt>m22</tt> to 1.5 will double the height and increase the width by 50%. The identity matrix has <tt>m11</tt> and <tt>m22</tt> set to 1 (all others are set to 0) mapping a point to itself. Shearing is controlled by <tt>m12</tt> and <tt>m21</tt>. Setting these elements to values different from zero will twist the coordinate system. Rotation is achieved by carefully setting both the shearing factors and the scaling factors.</p>
<p>Here's the combined transformations example using basic matrix operations:</p>
<table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qmatrix-combinedtransformation.png" alt="" /></td><td ><pre class="cpp"> <span class="type">void</span> BasicOperations<span class="operator">::</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
 {
     <span class="type">double</span> pi <span class="operator">=</span> <span class="number">3.14</span>;

     <span class="type">double</span> a    <span class="operator">=</span> pi<span class="operator">/</span><span class="number">180</span> <span class="operator">*</span> <span class="number">45.0</span>;
     <span class="type">double</span> sina <span class="operator">=</span> sin(a);
     <span class="type">double</span> cosa <span class="operator">=</span> cos(a);

     <span class="type">QMatrix</span> translationMatrix(<span class="number">1</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">1</span><span class="operator">,</span> <span class="number">50.0</span><span class="operator">,</span> <span class="number">50.0</span>);
     <span class="type">QMatrix</span> rotationMatrix(cosa<span class="operator">,</span> sina<span class="operator">,</span> <span class="operator">-</span>sina<span class="operator">,</span> cosa<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span>);
     <span class="type">QMatrix</span> scalingMatrix(<span class="number">0.5</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">1.0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span>);

     <span class="type">QMatrix</span> matrix;
     matrix <span class="operator">=</span>  scalingMatrix <span class="operator">*</span> rotationMatrix <span class="operator">*</span> translationMatrix;

     <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
     painter<span class="operator">.</span>setPen(<span class="type"><a href="qpen.html">QPen</a></span>(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>blue<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>DashLine));
     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>setMatrix(matrix);

     painter<span class="operator">.</span>setFont(<span class="type"><a href="qfont.html">QFont</a></span>(<span class="string">&quot;Helvetica&quot;</span><span class="operator">,</span> <span class="number">24</span>));
     painter<span class="operator">.</span>setPen(<span class="type"><a href="qpen.html">QPen</a></span>(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>black<span class="operator">,</span> <span class="number">1</span>));
     painter<span class="operator">.</span>drawText(<span class="number">20</span><span class="operator">,</span> <span class="number">10</span><span class="operator">,</span> <span class="string">&quot;QMatrix&quot;</span>);
 }</pre>
</td></tr>
</table>
</div>
<p><b>See also </b><a href="qpainter.html">QPainter</a>, <a href="qtransform.html">QTransform</a>, <a href="coordsys.html">Coordinate System</a>, <a href="demos-affine.html">Affine Transformations Demo</a>, and <a href="painting-transformations.html">Transformations Example</a>.</p>
<!-- @@@QMatrix -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QMatrix[overload1]$$$QMatrix -->
<h3 class="fn"><a name="QMatrix"></a>QMatrix::<span class="name">QMatrix</span> ()</h3>
<p>Constructs an identity matrix.</p>
<p>All elements are set to zero except <tt>m11</tt> and <tt>m22</tt> (specifying the scale), which are set to 1.</p>
<p><b>See also </b><a href="qmatrix.html#reset">reset</a>().</p>
<!-- @@@QMatrix -->
<!-- $$$QMatrix$$$QMatrixqrealqrealqrealqrealqrealqreal -->
<h3 class="fn"><a name="QMatrix-3"></a>QMatrix::<span class="name">QMatrix</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>m11</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>m12</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>m21</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>m22</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>dx</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>dy</i> )</h3>
<p>Constructs a matrix with the elements, <i>m11</i>, <i>m12</i>, <i>m21</i>, <i>m22</i>, <i>dx</i> and <i>dy</i>.</p>
<p><b>See also </b><a href="qmatrix.html#setMatrix">setMatrix</a>().</p>
<!-- @@@QMatrix -->
<!-- $$$QMatrix$$$QMatrixconstQMatrix& -->
<h3 class="fn"><a name="QMatrix-4"></a>QMatrix::<span class="name">QMatrix</span> ( const <span class="type">QMatrix</span> &amp; <i>matrix</i> )</h3>
<p>Constructs a matrix that is a copy of the given <i>matrix</i>.</p>
<!-- @@@QMatrix -->
<!-- $$$m11[overload1]$$$m11 -->
<h3 class="fn"><a name="m11"></a><span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> QMatrix::<span class="name">m11</span> () const</h3>
<p>Returns the horizontal scaling factor.</p>
<p><b>See also </b><a href="qmatrix.html#scale">scale</a>() and <a href="qmatrix.html#basic-matrix-operations" class="obsolete">Basic Matrix Operations</a>.</p>
<!-- @@@m11 -->
<!-- $$$m12[overload1]$$$m12 -->
<h3 class="fn"><a name="m12"></a><span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> QMatrix::<span class="name">m12</span> () const</h3>
<p>Returns the vertical shearing factor.</p>
<p><b>See also </b><a href="qmatrix.html#shear">shear</a>() and <a href="qmatrix.html#basic-matrix-operations" class="obsolete">Basic Matrix Operations</a>.</p>
<!-- @@@m12 -->
<!-- $$$m21[overload1]$$$m21 -->
<h3 class="fn"><a name="m21"></a><span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> QMatrix::<span class="name">m21</span> () const</h3>
<p>Returns the horizontal shearing factor.</p>
<p><b>See also </b><a href="qmatrix.html#shear">shear</a>() and <a href="qmatrix.html#basic-matrix-operations" class="obsolete">Basic Matrix Operations</a>.</p>
<!-- @@@m21 -->
<!-- $$$m22[overload1]$$$m22 -->
<h3 class="fn"><a name="m22"></a><span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> QMatrix::<span class="name">m22</span> () const</h3>
<p>Returns the vertical scaling factor.</p>
<p><b>See also </b><a href="qmatrix.html#scale">scale</a>() and <a href="qmatrix.html#basic-matrix-operations" class="obsolete">Basic Matrix Operations</a>.</p>
<!-- @@@m22 -->
<!-- $$$determinant[overload1]$$$determinant -->
<h3 class="fn"><a name="determinant"></a><span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> QMatrix::<span class="name">determinant</span> () const</h3>
<p>Returns the matrix's determinant.</p>
<p>This function was introduced in Qt 4.6.</p>
<!-- @@@determinant -->
<!-- $$$dx[overload1]$$$dx -->
<h3 class="fn"><a name="dx"></a><span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> QMatrix::<span class="name">dx</span> () const</h3>
<p>Returns the horizontal translation factor.</p>
<p><b>See also </b><a href="qmatrix.html#translate">translate</a>() and <a href="qmatrix.html#basic-matrix-operations" class="obsolete">Basic Matrix Operations</a>.</p>
<!-- @@@dx -->
<!-- $$$dy[overload1]$$$dy -->
<h3 class="fn"><a name="dy"></a><span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> QMatrix::<span class="name">dy</span> () const</h3>
<p>Returns the vertical translation factor.</p>
<p><b>See also </b><a href="qmatrix.html#translate">translate</a>() and <a href="qmatrix.html#basic-matrix-operations" class="obsolete">Basic Matrix Operations</a>.</p>
<!-- @@@dy -->
<!-- $$$inverted[overload1]$$$invertedbool* -->
<h3 class="fn"><a name="inverted"></a><span class="type">QMatrix</span> QMatrix::<span class="name">inverted</span> ( <span class="type">bool</span> * <i>invertible</i> = 0 ) const</h3>
<p>Returns an inverted copy of this matrix.</p>
<p>If the matrix is singular (not invertible), the returned matrix is the identity matrix. If <i>invertible</i> is valid (i.e&#x2e; not 0), its value is set to true if the matrix is invertible, otherwise it is set to false.</p>
<p><b>See also </b><a href="qmatrix.html#isInvertible">isInvertible</a>().</p>
<!-- @@@inverted -->
<!-- $$$isIdentity[overload1]$$$isIdentity -->
<h3 class="fn"><a name="isIdentity"></a><span class="type">bool</span> QMatrix::<span class="name">isIdentity</span> () const</h3>
<p>Returns true if the matrix is the identity matrix, otherwise returns false.</p>
<p><b>See also </b><a href="qmatrix.html#reset">reset</a>().</p>
<!-- @@@isIdentity -->
<!-- $$$isInvertible[overload1]$$$isInvertible -->
<h3 class="fn"><a name="isInvertible"></a><span class="type">bool</span> QMatrix::<span class="name">isInvertible</span> () const</h3>
<p>Returns true if the matrix is invertible, otherwise returns false.</p>
<p><b>See also </b><a href="qmatrix.html#inverted">inverted</a>().</p>
<!-- @@@isInvertible -->
<!-- $$$map[overload1]$$$mapqrealqrealqreal*qreal* -->
<h3 class="fn"><a name="map"></a><span class="type">void</span> QMatrix::<span class="name">map</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>x</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>y</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> * <i>tx</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> * <i>ty</i> ) const</h3>
<p>Maps the given coordinates <i>x</i> and <i>y</i> into the coordinate system defined by this matrix. The resulting values are put in *<i>tx</i> and *<i>ty</i>, respectively.</p>
<p>The coordinates are transformed using the following formulas:</p>
<pre class="cpp"> x<span class="char">' = m11*x + m21*y + dx
 y'</span> <span class="operator">=</span> m22<span class="operator">*</span>y <span class="operator">+</span> m12<span class="operator">*</span>x <span class="operator">+</span> dy</pre>
<p>The point (x, y) is the original point, and (x', y') is the transformed point.</p>
<p><b>See also </b><a href="qmatrix.html#basic-matrix-operations" class="obsolete">Basic Matrix Operations</a>.</p>
<!-- @@@map -->
<!-- $$$map$$$mapintintint*int* -->
<h3 class="fn"><a name="map-3"></a><span class="type">void</span> QMatrix::<span class="name">map</span> ( <span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> * <i>tx</i>, <span class="type">int</span> * <i>ty</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Maps the given coordinates <i>x</i> and <i>y</i> into the coordinate system defined by this matrix. The resulting values are put in *<i>tx</i> and *<i>ty</i>, respectively. Note that the transformed coordinates are rounded to the nearest integer.</p>
<!-- @@@map -->
<!-- $$$map$$$mapconstQPointF& -->
<h3 class="fn"><a name="map-4"></a><span class="type"><a href="qpointf.html">QPointF</a></span> QMatrix::<span class="name">map</span> ( const <span class="type"><a href="qpointf.html">QPointF</a></span> &amp; <i>point</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Creates and returns a <a href="qpointf.html">QPointF</a> object that is a copy of the given <i>point</i>, mapped into the coordinate system defined by this matrix.</p>
<!-- @@@map -->
<!-- $$$map$$$mapconstQPoint& -->
<h3 class="fn"><a name="map-5"></a><span class="type"><a href="qpoint.html">QPoint</a></span> QMatrix::<span class="name">map</span> ( const <span class="type"><a href="qpoint.html">QPoint</a></span> &amp; <i>point</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Creates and returns a <a href="qpoint.html">QPoint</a> object that is a copy of the given <i>point</i>, mapped into the coordinate system defined by this matrix. Note that the transformed coordinates are rounded to the nearest integer.</p>
<!-- @@@map -->
<!-- $$$map$$$mapconstQLineF& -->
<h3 class="fn"><a name="map-6"></a><span class="type"><a href="qlinef.html">QLineF</a></span> QMatrix::<span class="name">map</span> ( const <span class="type"><a href="qlinef.html">QLineF</a></span> &amp; <i>line</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Creates and returns a <a href="qlinef.html">QLineF</a> object that is a copy of the given <i>line</i>, mapped into the coordinate system defined by this matrix.</p>
<!-- @@@map -->
<!-- $$$map$$$mapconstQLine& -->
<h3 class="fn"><a name="map-7"></a><span class="type"><a href="qline.html">QLine</a></span> QMatrix::<span class="name">map</span> ( const <span class="type"><a href="qline.html">QLine</a></span> &amp; <i>line</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Creates and returns a <a href="qline.html">QLine</a> object that is a copy of the given <i>line</i>, mapped into the coordinate system defined by this matrix. Note that the transformed coordinates are rounded to the nearest integer.</p>
<!-- @@@map -->
<!-- $$$map$$$mapconstQPolygonF& -->
<h3 class="fn"><a name="map-8"></a><span class="type"><a href="qpolygonf.html">QPolygonF</a></span> QMatrix::<span class="name">map</span> ( const <span class="type"><a href="qpolygonf.html">QPolygonF</a></span> &amp; <i>polygon</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Creates and returns a <a href="qpolygonf.html">QPolygonF</a> object that is a copy of the given <i>polygon</i>, mapped into the coordinate system defined by this matrix.</p>
<!-- @@@map -->
<!-- $$$map$$$mapconstQPolygon& -->
<h3 class="fn"><a name="map-9"></a><span class="type"><a href="qpolygon.html">QPolygon</a></span> QMatrix::<span class="name">map</span> ( const <span class="type"><a href="qpolygon.html">QPolygon</a></span> &amp; <i>polygon</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Creates and returns a <a href="qpolygon.html">QPolygon</a> object that is a copy of the given <i>polygon</i>, mapped into the coordinate system defined by this matrix. Note that the transformed coordinates are rounded to the nearest integer.</p>
<!-- @@@map -->
<!-- $$$map$$$mapconstQRegion& -->
<h3 class="fn"><a name="map-10"></a><span class="type"><a href="qregion.html">QRegion</a></span> QMatrix::<span class="name">map</span> ( const <span class="type"><a href="qregion.html">QRegion</a></span> &amp; <i>region</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Creates and returns a <a href="qregion.html">QRegion</a> object that is a copy of the given <i>region</i>, mapped into the coordinate system defined by this matrix.</p>
<p>Calling this method can be rather expensive if rotations or shearing are used.</p>
<!-- @@@map -->
<!-- $$$map$$$mapconstQPainterPath& -->
<h3 class="fn"><a name="map-11"></a><span class="type"><a href="qpainterpath.html">QPainterPath</a></span> QMatrix::<span class="name">map</span> ( const <span class="type"><a href="qpainterpath.html">QPainterPath</a></span> &amp; <i>path</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Creates and returns a <a href="qpainterpath.html">QPainterPath</a> object that is a copy of the given <i>path</i>, mapped into the coordinate system defined by this matrix.</p>
<!-- @@@map -->
<!-- $$$mapRect[overload1]$$$mapRectconstQRectF& -->
<h3 class="fn"><a name="mapRect"></a><span class="type"><a href="qrectf.html">QRectF</a></span> QMatrix::<span class="name">mapRect</span> ( const <span class="type"><a href="qrectf.html">QRectF</a></span> &amp; <i>rectangle</i> ) const</h3>
<p>Creates and returns a <a href="qrectf.html">QRectF</a> object that is a copy of the given <i>rectangle</i>, mapped into the coordinate system defined by this matrix.</p>
<p>The rectangle's coordinates are transformed using the following formulas:</p>
<pre class="cpp"> x<span class="char">' = m11*x + m21*y + dx
 y'</span> <span class="operator">=</span> m22<span class="operator">*</span>y <span class="operator">+</span> m12<span class="operator">*</span>x <span class="operator">+</span> dy</pre>
<p>If rotation or shearing has been specified, this function returns the <i>bounding</i> rectangle. To retrieve the exact region the given <i>rectangle</i> maps to, use the <a href="qmatrix.html#mapToPolygon">mapToPolygon</a>() function instead.</p>
<p><b>See also </b><a href="qmatrix.html#mapToPolygon">mapToPolygon</a>() and <a href="qmatrix.html#basic-matrix-operations" class="obsolete">Basic Matrix Operations</a>.</p>
<!-- @@@mapRect -->
<!-- $$$mapRect$$$mapRectconstQRect& -->
<h3 class="fn"><a name="mapRect-2"></a><span class="type"><a href="qrect.html">QRect</a></span> QMatrix::<span class="name">mapRect</span> ( const <span class="type"><a href="qrect.html">QRect</a></span> &amp; <i>rectangle</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Creates and returns a <a href="qrect.html">QRect</a> object that is a copy of the given <i>rectangle</i>, mapped into the coordinate system defined by this matrix. Note that the transformed coordinates are rounded to the nearest integer.</p>
<!-- @@@mapRect -->
<!-- $$$mapToPolygon[overload1]$$$mapToPolygonconstQRect& -->
<h3 class="fn"><a name="mapToPolygon"></a><span class="type"><a href="qpolygon.html">QPolygon</a></span> QMatrix::<span class="name">mapToPolygon</span> ( const <span class="type"><a href="qrect.html">QRect</a></span> &amp; <i>rectangle</i> ) const</h3>
<p>Creates and returns a <a href="qpolygon.html">QPolygon</a> representation of the given <i>rectangle</i>, mapped into the coordinate system defined by this matrix.</p>
<p>The rectangle's coordinates are transformed using the following formulas:</p>
<pre class="cpp"> x<span class="char">' = m11*x + m21*y + dx
 y'</span> <span class="operator">=</span> m22<span class="operator">*</span>y <span class="operator">+</span> m12<span class="operator">*</span>x <span class="operator">+</span> dy</pre>
<p>Polygons and rectangles behave slightly differently when transformed (due to integer rounding), so <tt>matrix.map(QPolygon(rectangle))</tt> is not always the same as <tt>matrix.mapToPolygon(rectangle)</tt>.</p>
<p><b>See also </b><a href="qmatrix.html#mapRect">mapRect</a>() and <a href="qmatrix.html#basic-matrix-operations" class="obsolete">Basic Matrix Operations</a>.</p>
<!-- @@@mapToPolygon -->
<!-- $$$reset[overload1]$$$reset -->
<h3 class="fn"><a name="reset"></a><span class="type">void</span> QMatrix::<span class="name">reset</span> ()</h3>
<p>Resets the matrix to an identity matrix, i.e&#x2e; all elements are set to zero, except <tt>m11</tt> and <tt>m22</tt> (specifying the scale) which are set to 1.</p>
<p><b>See also </b><a href="qmatrix.html#QMatrix">QMatrix</a>(), <a href="qmatrix.html#isIdentity">isIdentity</a>(), and <a href="qmatrix.html#basic-matrix-operations" class="obsolete">Basic Matrix Operations</a>.</p>
<!-- @@@reset -->
<!-- $$$rotate[overload1]$$$rotateqreal -->
<h3 class="fn"><a name="rotate"></a><span class="type">QMatrix</span> &amp; QMatrix::<span class="name">rotate</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>degrees</i> )</h3>
<p>Rotates the coordinate system the given <i>degrees</i> counterclockwise.</p>
<p>Note that if you apply a <a href="qmatrix.html" class="obsolete">QMatrix</a> to a point defined in widget coordinates, the direction of the rotation will be clockwise because the y-axis points downwards.</p>
<p>Returns a reference to the matrix.</p>
<p><b>See also </b><a href="qmatrix.html#setMatrix">setMatrix</a>().</p>
<!-- @@@rotate -->
<!-- $$$scale[overload1]$$$scaleqrealqreal -->
<h3 class="fn"><a name="scale"></a><span class="type">QMatrix</span> &amp; QMatrix::<span class="name">scale</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>sx</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>sy</i> )</h3>
<p>Scales the coordinate system by <i>sx</i> horizontally and <i>sy</i> vertically, and returns a reference to the matrix.</p>
<p><b>See also </b><a href="qmatrix.html#setMatrix">setMatrix</a>().</p>
<!-- @@@scale -->
<!-- $$$setMatrix[overload1]$$$setMatrixqrealqrealqrealqrealqrealqreal -->
<h3 class="fn"><a name="setMatrix"></a><span class="type">void</span> QMatrix::<span class="name">setMatrix</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>m11</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>m12</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>m21</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>m22</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>dx</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>dy</i> )</h3>
<p>Sets the matrix elements to the specified values, <i>m11</i>, <i>m12</i>, <i>m21</i>, <i>m22</i>, <i>dx</i> and <i>dy</i>.</p>
<p>Note that this function replaces the previous values. <a href="qmatrix.html" class="obsolete">QMatrix</a> provide the <a href="qmatrix.html#translate">translate</a>(), <a href="qmatrix.html#rotate">rotate</a>(), <a href="qmatrix.html#scale">scale</a>() and <a href="qmatrix.html#shear">shear</a>() convenience functions to manipulate the various matrix elements based on the currently defined coordinate system.</p>
<p><b>See also </b><a href="qmatrix.html#QMatrix">QMatrix</a>().</p>
<!-- @@@setMatrix -->
<!-- $$$shear[overload1]$$$shearqrealqreal -->
<h3 class="fn"><a name="shear"></a><span class="type">QMatrix</span> &amp; QMatrix::<span class="name">shear</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>sh</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>sv</i> )</h3>
<p>Shears the coordinate system by <i>sh</i> horizontally and <i>sv</i> vertically, and returns a reference to the matrix.</p>
<p><b>See also </b><a href="qmatrix.html#setMatrix">setMatrix</a>().</p>
<!-- @@@shear -->
<!-- $$$translate[overload1]$$$translateqrealqreal -->
<h3 class="fn"><a name="translate"></a><span class="type">QMatrix</span> &amp; QMatrix::<span class="name">translate</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>dx</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>dy</i> )</h3>
<p>Moves the coordinate system <i>dx</i> along the x axis and <i>dy</i> along the y axis, and returns a reference to the matrix.</p>
<p><b>See also </b><a href="qmatrix.html#setMatrix">setMatrix</a>().</p>
<!-- @@@translate -->
<!-- $$$operator QVariant[overload1]$$$operator QVariant -->
<h3 class="fn"><a name="operator-QVariant"></a>QMatrix::<span class="name">operator QVariant</span> () const</h3>
<p>Returns the matrix as a <a href="qvariant.html">QVariant</a>.</p>
<p>This function was introduced in Qt 4.2.</p>
<!-- @@@operator QVariant -->
<!-- $$$operator!=[overload1]$$$operator!=constQMatrix& -->
<h3 class="fn"><a name="operator-not-eq"></a><span class="type">bool</span> QMatrix::<span class="name">operator!=</span> ( const <span class="type">QMatrix</span> &amp; <i>matrix</i> ) const</h3>
<p>Returns true if this matrix is not equal to the given <i>matrix</i>, otherwise returns false.</p>
<!-- @@@operator!= -->
<!-- $$$operator*[overload1]$$$operator*constQMatrix& -->
<h3 class="fn"><a name="operator-2a"></a><span class="type">QMatrix</span> QMatrix::<span class="name">operator*</span> ( const <span class="type">QMatrix</span> &amp; <i>matrix</i> ) const</h3>
<p>Returns the result of multiplying this matrix by the given <i>matrix</i>.</p>
<p>Note that matrix multiplication is not commutative, i.e&#x2e; a*b != b*a.</p>
<!-- @@@operator* -->
<!-- $$$operator*=[overload1]$$$operator*=constQMatrix& -->
<h3 class="fn"><a name="operator-2a-eq"></a><span class="type">QMatrix</span> &amp; QMatrix::<span class="name">operator*=</span> ( const <span class="type">QMatrix</span> &amp; <i>matrix</i> )</h3>
<p>This is an overloaded function.</p>
<p>Returns the result of multiplying this matrix by the given <i>matrix</i>.</p>
<!-- @@@operator*= -->
<!-- $$$operator=[overload1]$$$operator=constQMatrix& -->
<h3 class="fn"><a name="operator-eq"></a><span class="type">QMatrix</span> &amp; QMatrix::<span class="name">operator=</span> ( const <span class="type">QMatrix</span> &amp; <i>matrix</i> )</h3>
<p>Assigns the given <i>matrix</i>'s values to this matrix.</p>
<!-- @@@operator= -->
<!-- $$$operator==[overload1]$$$operator==constQMatrix& -->
<h3 class="fn"><a name="operator-eq-eq"></a><span class="type">bool</span> QMatrix::<span class="name">operator==</span> ( const <span class="type">QMatrix</span> &amp; <i>matrix</i> ) const</h3>
<p>Returns true if this matrix is equal to the given <i>matrix</i>, otherwise returns false.</p>
<!-- @@@operator== -->
</div>
<div class="relnonmem">
<h2>Related Non-Members</h2>
<!-- $$$qFuzzyCompare$$$qFuzzyCompareconstQMatrix&constQMatrix& -->
<h3 class="fn"><a name="qFuzzyCompare-3"></a><span class="type">bool</span> <span class="name">qFuzzyCompare</span> ( const <span class="type">QMatrix</span> &amp; <i>m1</i>, const <span class="type">QMatrix</span> &amp; <i>m2</i> )</h3>
<p>The qFuzzyCompare function is for comparing two matrices using a fuzziness factor.</p>
<p>Returns true if <i>m1</i> and <i>m2</i> are equal, allowing for a small fuzziness factor for floating-point comparisons; false otherwise.</p>
<p>This function was introduced in Qt 4.6.</p>
<!-- @@@qFuzzyCompare -->
<!-- $$$operator*$$$operator*constQPoint&constQMatrix& -->
<h3 class="fn"><a name="operator-2a-15"></a><span class="type"><a href="qpoint.html">QPoint</a></span> <span class="name">operator*</span> ( const <span class="type"><a href="qpoint.html">QPoint</a></span> &amp; <i>point</i>, const <span class="type">QMatrix</span> &amp; <i>matrix</i> )</h3>
<p>This is the same as <i>matrix</i>.map(<i>point</i>).</p>
<p><b>See also </b><a href="qmatrix.html#map">QMatrix::map</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator*$$$operator*constQPointF&constQMatrix& -->
<h3 class="fn"><a name="operator-2a-16"></a><span class="type"><a href="qpointf.html">QPointF</a></span> <span class="name">operator*</span> ( const <span class="type"><a href="qpointf.html">QPointF</a></span> &amp; <i>point</i>, const <span class="type">QMatrix</span> &amp; <i>matrix</i> )</h3>
<p>Same as <i>matrix</i>.map(<i>point</i>).</p>
<p><b>See also </b><a href="qmatrix.html#map">QMatrix::map</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator*$$$operator*constQLineF&constQMatrix& -->
<h3 class="fn"><a name="operator-2a-17"></a><span class="type"><a href="qlinef.html">QLineF</a></span> <span class="name">operator*</span> ( const <span class="type"><a href="qlinef.html">QLineF</a></span> &amp; <i>line</i>, const <span class="type">QMatrix</span> &amp; <i>matrix</i> )</h3>
<p>This is the same as <i>matrix</i>.map(<i>line</i>).</p>
<p><b>See also </b><a href="qmatrix.html#map">QMatrix::map</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator*$$$operator*constQLine&constQMatrix& -->
<h3 class="fn"><a name="operator-2a-18"></a><span class="type"><a href="qline.html">QLine</a></span> <span class="name">operator*</span> ( const <span class="type"><a href="qline.html">QLine</a></span> &amp; <i>line</i>, const <span class="type">QMatrix</span> &amp; <i>matrix</i> )</h3>
<p>This is the same as <i>matrix</i>.map(<i>line</i>).</p>
<p><b>See also </b><a href="qmatrix.html#map">QMatrix::map</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator*$$$operator*constQPolygon&constQMatrix& -->
<h3 class="fn"><a name="operator-2a-19"></a><span class="type"><a href="qpolygon.html">QPolygon</a></span> <span class="name">operator*</span> ( const <span class="type"><a href="qpolygon.html">QPolygon</a></span> &amp; <i>polygon</i>, const <span class="type">QMatrix</span> &amp; <i>matrix</i> )</h3>
<p>This is the same as <i>matrix</i>.map(<i>polygon</i>).</p>
<p><b>See also </b><a href="qmatrix.html#map">QMatrix::map</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator*$$$operator*constQPolygonF&constQMatrix& -->
<h3 class="fn"><a name="operator-2a-20"></a><span class="type"><a href="qpolygonf.html">QPolygonF</a></span> <span class="name">operator*</span> ( const <span class="type"><a href="qpolygonf.html">QPolygonF</a></span> &amp; <i>polygon</i>, const <span class="type">QMatrix</span> &amp; <i>matrix</i> )</h3>
<p>This is the same as <i>matrix</i>.map(<i>polygon</i>).</p>
<p><b>See also </b><a href="qmatrix.html#map">QMatrix::map</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator*$$$operator*constQRegion&constQMatrix& -->
<h3 class="fn"><a name="operator-2a-21"></a><span class="type"><a href="qregion.html">QRegion</a></span> <span class="name">operator*</span> ( const <span class="type"><a href="qregion.html">QRegion</a></span> &amp; <i>region</i>, const <span class="type">QMatrix</span> &amp; <i>matrix</i> )</h3>
<p>This is the same as <i>matrix</i>.map(<i>region</i>).</p>
<p><b>See also </b><a href="qmatrix.html#map">QMatrix::map</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator*$$$operator*constQPainterPath&constQMatrix& -->
<h3 class="fn"><a name="operator-2a-22"></a><span class="type"><a href="qpainterpath.html">QPainterPath</a></span> <span class="name">operator*</span> ( const <span class="type"><a href="qpainterpath.html">QPainterPath</a></span> &amp; <i>path</i>, const <span class="type">QMatrix</span> &amp; <i>matrix</i> )</h3>
<p>This is the same as <i>matrix</i>.map(<i>path</i>).</p>
<p><b>See also </b><a href="qmatrix.html#map">QMatrix::map</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator<<$$$operator<<QDataStream&constQMatrix& -->
<h3 class="fn"><a name="operator-lt-lt-27"></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">QMatrix</span> &amp; <i>matrix</i> )</h3>
<p>Writes the given <i>matrix</i> to the given <i>stream</i> and returns a reference to the stream.</p>
<p><b>See also </b><a href="datastreamformat.html">Serializing Qt Data Types</a>.</p>
<!-- @@@operator<< -->
<!-- $$$operator>>$$$operator>>QDataStream&QMatrix& -->
<h3 class="fn"><a name="operator-gt-gt-17"></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">QMatrix</span> &amp; <i>matrix</i> )</h3>
<p>Reads the given <i>matrix</i> from the given <i>stream</i> and returns a reference to the stream.</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> 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>