Sophie

Sophie

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

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" />
<!-- qdeclarativerectangle.cpp -->
  <title>Qt 4.8: QML Rectangle Element</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="qdeclarativeelements.html">QML Elements</a></li>
<li>QML Rectangle Element</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">
<p class="naviNextPrevious headerNavi">
</p><p/>
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#appearance">Appearance</a></li>
<li class="level2"><a href="#example-usage">Example Usage</a></li>
<li class="level2"><a href="#performance">Performance</a></li>
</ul>
</div>
<h1 class="title">QML Rectangle Element</h1>
<span class="subtitle"></span>
<!-- $$$Rectangle-brief -->
<p>The Rectangle item provides a filled rectangle with an optional border. <a href="#details">More...</a></p>
<!-- @@@Rectangle -->
<p>Inherits <a href="qml-item.html">Item</a></p>
<p>Inherited by main.</p>
<p>This element was introduced in Qt 4.7.</p>
<ul>
<li><a href="qml-rectangle-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="properties"></a>
<h2>Properties</h2>
<ul>
<li class="fn"><b><b><a href="qml-rectangle.html#border.color-prop">border.color</a></b></b> : color</li>
<li class="fn"><b><b><a href="qml-rectangle.html#border.width-prop">border.width</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-rectangle.html#color-prop">color</a></b></b> : color</li>
<li class="fn"><b><b><a href="qml-rectangle.html#gradient-prop">gradient</a></b></b> : Gradient</li>
<li class="fn"><b><b><a href="qml-rectangle.html#radius-prop">radius</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-rectangle.html#smooth-prop">smooth</a></b></b> : bool</li>
</ul>
<!-- $$$Rectangle-description -->
<a name="details"></a>
<h2>Detailed Description</h2>
<p>Rectangle items are used to fill areas with solid color or gradients, and are often used to hold other items.</p>
<a name="appearance"></a>
<h2>Appearance</h2>
<p>Each Rectangle item is painted using either a solid fill color, specified using the <a href="qml-rectangle.html#color-prop">color</a> property, or a gradient, defined using a Gradient element and set using the <a href="qml-rectangle.html#gradient-prop">gradient</a> property. If both a color and a gradient are specified, the gradient is used.</p>
<p>You can add an optional border to a rectangle with its own color and thickness by settting the <a href="qml-rectangle.html#border.color-prop">border.color</a> and <a href="qml-rectangle.html#border.width-prop">border.width</a> properties.</p>
<p>You can also create rounded rectangles using the <a href="qml-rectangle.html#radius-prop">radius</a> property. Since this introduces curved edges to the corners of a rectangle, it may be appropriate to set the <a href="qml-rectangle.html#smooth-prop">smooth</a> property to improve its appearance.</p>
<a name="example-usage"></a>
<h2>Example Usage</h2>
<div class="float-right"><p><img src="images/declarative-rect.png" alt="" /></p>
</div><p>The following example shows the effects of some of the common properties on a Rectangle item, which in this case is used to create a square:</p>
<pre class="qml"> import QtQuick 1.0

 <span class="type">Rectangle</span> {
     <span class="name">width</span>: <span class="number">100</span>
     <span class="name">height</span>: <span class="number">100</span>
     <span class="name">color</span>: <span class="string">&quot;red&quot;</span>
     <span class="name">border</span>.color: <span class="string">&quot;black&quot;</span>
     <span class="name">border</span>.width: <span class="number">5</span>
     <span class="name">radius</span>: <span class="number">10</span>
 }</pre>
<br style="clear: both" /><a name="performance"></a>
<h2>Performance</h2>
<p>Using the <a href="qml-rectangle.html#smooth-prop">smooth</a> property improves the appearance of a rounded rectangle at the cost of rendering performance. You should consider unsetting this property for rectangles in motion, and only set it when they are stationary.</p>
<p><b>See also </b><a href="qml-image.html">Image</a>.</p>
<!-- @@@Rectangle -->
<h2>Property Documentation</h2>
<!-- $$$border.width -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlPropNode"><p><a name="border.width-prop"></a><span class="name">border.width</span> : <span class="type"><a href="qml-int.html">int</a></span></p></td></tr><tr valign="top" class="even"><td class="tblQmlPropNode"><p><a name="border.color-prop"></a><span class="name">border.color</span> : <span class="type"><a href="qml-rectangle.html#color-prop">color</a></span></p></td></tr></table></div><div class="qmldoc"><p>The width and color used to draw the border of the rectangle.</p>
<p>A width of 1 creates a thin line. For no line, use a width of 0 or a transparent color.</p>
<p><b>Note:</b> The width of the rectangle's border does not affect the geometry of the rectangle itself or its position relative to other items if anchors are used.</p>
<p>If <tt>border.width</tt> is an odd number, the rectangle is painted at a half-pixel offset to retain border smoothness. Also, the border is rendered evenly on either side of the rectangle's boundaries, and the spare pixel is rendered to the right and below the rectangle (as documented for <a href="qrect.html">QRect</a> rendering). This can cause unintended effects if <tt>border.width</tt> is 1 and the rectangle is <a href="qml-item.html#clip-prop">clipped</a> by a parent item:</p>
<div class="float-right"><p><img src="images/rect-border-width.png" alt="" /></p>
</div><pre class="qml"> <span class="type"><a href="qml-rectangle.html">Rectangle</a></span> {
     <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span>
     <span class="name">color</span>: <span class="string">&quot;lightblue&quot;</span>

     <span class="type"><a href="qml-rectangle.html">Rectangle</a></span> {
         <span class="name">anchors</span>.fill: <span class="name">parent</span>
         <span class="name">anchors</span>.margins: <span class="number">10</span>
         <span class="name">clip</span>: <span class="number">true</span>

         <span class="type"><a href="qml-rectangle.html">Rectangle</a></span> {
             <span class="name">anchors</span>.fill: <span class="name">parent</span>
             <span class="name">border</span>.width: <span class="number">1</span>
         }
     }
 }</pre>
<br style="clear: both" /><p>Here, the innermost rectangle's border is clipped on the bottom and right edges by its parent. To avoid this, the border width can be set to two instead of one.</p>
</div></div><!-- @@@border.width -->
<br/>
<!-- $$$color -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlPropNode"><p><a name="color-prop"></a><span class="name">color</span> : <span class="type"><a href="qml-color.html">color</a></span></p></td></tr></table></div><div class="qmldoc"><p>This property holds the color used to fill the rectangle.</p>
<p>The default color is white.</p>
<div class="float-right"><p><img src="images/rect-color.png" alt="" /></p>
</div><p>The following example shows rectangles with colors specified using hexadecimal and named color notation:</p>
<pre class="qml"> <span class="type"><a href="qml-rectangle.html">Rectangle</a></span> {
     <span class="name">color</span>: <span class="string">&quot;#00B000&quot;</span>
     <span class="name">width</span>: <span class="number">80</span>; <span class="name">height</span>: <span class="number">80</span>
 }

 <span class="type"><a href="qml-rectangle.html">Rectangle</a></span> {
     <span class="name">color</span>: <span class="string">&quot;steelblue&quot;</span>
     <span class="name">y</span>: <span class="number">100</span>; <span class="name">width</span>: <span class="number">80</span>; <span class="name">height</span>: <span class="number">80</span>
 }</pre>
<br style="clear: both" /><p>If both a gradient and a color are specified, the gradient will be used.</p>
<p><b>See also </b><a href="qml-rectangle.html#gradient-prop">gradient</a>.</p>
</div></div><!-- @@@color -->
<br/>
<!-- $$$gradient -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlPropNode"><p><a name="gradient-prop"></a><span class="name">gradient</span> : <span class="type"><a href="qml-gradient.html">Gradient</a></span></p></td></tr></table></div><div class="qmldoc"><p>The gradient to use to fill the rectangle.</p>
<p>This property allows for the construction of simple vertical gradients. Other gradients may by formed by adding rotation to the rectangle.</p>
<div class="float-left"><p><img src="images/declarative-rect_gradient.png" alt="" /></p>
</div><pre class="qml"> <span class="type"><a href="qml-rectangle.html">Rectangle</a></span> {
     <span class="name">y</span>: <span class="number">0</span>; <span class="name">width</span>: <span class="number">80</span>; <span class="name">height</span>: <span class="number">80</span>
     <span class="name">color</span>: <span class="string">&quot;lightsteelblue&quot;</span>
 }

 <span class="type"><a href="qml-rectangle.html">Rectangle</a></span> {
     <span class="name">y</span>: <span class="number">100</span>; <span class="name">width</span>: <span class="number">80</span>; <span class="name">height</span>: <span class="number">80</span>
     <span class="name">gradient</span>: <span class="name">Gradient</span> {
         <span class="type"><a href="qml-gradientstop.html">GradientStop</a></span> { <span class="name">position</span>: <span class="number">0.0</span>; <span class="name">color</span>: <span class="string">&quot;lightsteelblue&quot;</span> }
         <span class="type"><a href="qml-gradientstop.html">GradientStop</a></span> { <span class="name">position</span>: <span class="number">1.0</span>; <span class="name">color</span>: <span class="string">&quot;blue&quot;</span> }
     }
 }

 <span class="type"><a href="qml-rectangle.html">Rectangle</a></span> {
     <span class="name">y</span>: <span class="number">200</span>; <span class="name">width</span>: <span class="number">80</span>; <span class="name">height</span>: <span class="number">80</span>
     <span class="name">rotation</span>: <span class="number">90</span>
     <span class="name">gradient</span>: <span class="name">Gradient</span> {
         <span class="type"><a href="qml-gradientstop.html">GradientStop</a></span> { <span class="name">position</span>: <span class="number">0.0</span>; <span class="name">color</span>: <span class="string">&quot;lightsteelblue&quot;</span> }
         <span class="type"><a href="qml-gradientstop.html">GradientStop</a></span> { <span class="name">position</span>: <span class="number">1.0</span>; <span class="name">color</span>: <span class="string">&quot;blue&quot;</span> }
     }
 }</pre>
<br style="clear: both" /><p>If both a gradient and a color are specified, the gradient will be used.</p>
<p><b>See also </b><a href="qml-gradient.html">Gradient</a> and <a href="qml-rectangle.html#color-prop">color</a>.</p>
</div></div><!-- @@@gradient -->
<br/>
<!-- $$$radius -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlPropNode"><p><a name="radius-prop"></a><span class="name">radius</span> : <span class="type"><a href="qml-real.html">real</a></span></p></td></tr></table></div><div class="qmldoc"><p>This property holds the corner radius used to draw a rounded rectangle.</p>
<p>If radius is non-zero, the rectangle will be painted as a rounded rectangle, otherwise it will be painted as a normal rectangle. The same radius is used by all 4 corners; there is currently no way to specify different radii for different corners.</p>
</div></div><!-- @@@radius -->
<br/>
<!-- $$$smooth -->
<div class="qmlitem"><div class="qmlproto"><table class="qmlname"><tr valign="top" class="odd"><td class="tblQmlPropNode"><p><a name="smooth-prop"></a><span class="name">smooth</span> : <span class="type"><a href="qml-bool.html">bool</a></span></p></td></tr></table></div><div class="qmldoc"><p>Set this property if you want the item to be smoothly scaled or transformed. Smooth filtering gives better visual quality, but is slower. If the item is displayed at its natural size, this property has no visual or performance effect.</p>
<p><b>Note:</b> Generally scaling artifacts are only visible if the item is stationary on the screen. A common pattern when animating an item is to disable smooth filtering at the beginning of the animation and reenable it at the conclusion.</p>
<p class="centerAlign"><img src="images/rect-smooth.png" alt="" /></p><p>On this image, smooth is turned off on the top half and on on the bottom half.</p>
</div></div><!-- @@@smooth -->
<br/>
<p class="naviNextPrevious footerNavi">
</p>
      </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>