Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 717

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QGradient Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QGradient Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QGradient class is used in combination with <a href="qbrush.html">QBrush</a> to specify gradient fills. <a href="#details">More...</a></p>

<p>Inherited by <a href="qconicalgradient.html">QConicalGradient</a>, <a href="qlineargradient.html">QLinearGradient</a> and <a href="qradialgradient.html">QRadialGradient</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qgradient.html#CoordinateMode-enum">CoordinateMode</a></b> { LogicalMode, StretchToDeviceMode, ObjectBoundingMode }</li><li><div class="fn" />enum <b><a href="qgradient.html#Spread-enum">Spread</a></b> { PadSpread, ReflectSpread, RepeatSpread }</li><li><div class="fn" />enum <b><a href="qgradient.html#Type-enum">Type</a></b> { LinearGradient, RadialGradient, ConicalGradient, NoGradient }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qgradient.html#QGradient">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qgradient.html#QGradient-2">__init__</a></b> (<i>self</i>, QGradient)</li><li><div class="fn" />CoordinateMode <b><a href="qgradient.html#coordinateMode">coordinateMode</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qgradient.html#setColorAt">setColorAt</a></b> (<i>self</i>, float&#160;<i>pos</i>, QColor&#160;<i>color</i>)</li><li><div class="fn" /><b><a href="qgradient.html#setCoordinateMode">setCoordinateMode</a></b> (<i>self</i>, CoordinateMode&#160;<i>mode</i>)</li><li><div class="fn" /><b><a href="qgradient.html#setSpread">setSpread</a></b> (<i>self</i>, Spread&#160;<i>aspread</i>)</li><li><div class="fn" /><b><a href="qgradient.html#setStops">setStops</a></b> (<i>self</i>, list-of-tuple-of-float-QColor&#160;<i>stops</i>)</li><li><div class="fn" />Spread <b><a href="qgradient.html#spread">spread</a></b> (<i>self</i>)</li><li><div class="fn" />list-of-tuple-of-float-QColor <b><a href="qgradient.html#stops">stops</a></b> (<i>self</i>)</li><li><div class="fn" />Type <b><a href="qgradient.html#type">type</a></b> (<i>self</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="qgradient.html#__eq__">__eq__</a></b> (<i>self</i>, QGradient&#160;<i>gradient</i>)</li><li><div class="fn" />bool <b><a href="qgradient.html#__ne__">__ne__</a></b> (<i>self</i>, QGradient&#160;<i>other</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QGradient class is used in combination with <a href="qbrush.html">QBrush</a> to specify gradient fills.</p>
<p>Qt currently supports three types of gradient fills:</p>
<ul>
<li><i>Linear</i> gradients interpolate colors between start and
end points.</li>
<li><i>Simple</i> radial gradients interpolate colors between a
focal point and end points on a circle surrounding it.</li>
<li><i>Extended</i> radial gradients interpolate colors between a
center and a focal circle.</li>
<li><i>Conical</i> gradients interpolate colors around a center
point.</li>
</ul>
<p>A gradient's type can be retrieved using the <a href="qgradient.html#type">type</a>() function. Each of the types is
represented by a subclass of QGradient:</p>
<table class="generic">
<thead>
<tr class="qt-style">
<th><a href="qlineargradient.html">QLinearGradient</a></th>
<th><a href="qradialgradient.html">QRadialGradient</a></th>
<th><a href="qconicalgradient.html">QConicalGradient</a></th>
</tr>
</thead>
<tr class="odd" valign="top">
<td><img alt="" src="images/qgradient-linear.png" /></td>
<td><img alt="" src="images/qgradient-radial.png" /></td>
<td><img alt="" src="images/qgradient-conical.png" /></td>
</tr>
</table>
<p>The colors in a gradient are defined using stop points of the
<a href="qgradient.html#QGradientStop-typedef">QGradientStop</a>
type; i.e., a position and a color. Use the <a href="qgradient.html#setColorAt">setColorAt</a>() function to define a
single stop point. Alternatively, use the <a href="qgradient.html#setStops">setStops</a>() function to define several
stop points in one go. Note that the latter function
<i>replaces</i> the current set of stop points.</p>
<p>It is the gradient's complete set of stop points (accessible
through the <a href="qgradient.html#stops">stops</a>() function)
that describes how the gradient area should be filled. If no stop
points have been specified, a gradient of black at 0 to white at 1
is used.</p>
<p>A diagonal linear gradient from black at (100, 100) to white at
(200, 200) could be specified like this:</p>
<pre class="cpp">
     <span class="type"><a href="qlineargradient.html">QLinearGradient</a></span> linearGrad(<span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">100</span><span class="operator">,</span> <span class="number">100</span>)<span class="operator">,</span> <span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">200</span><span class="operator">,</span> <span class="number">200</span>));
     linearGrad<span class="operator">.</span>setColorAt(<span class="number">0</span><span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>black);
     linearGrad<span class="operator">.</span>setColorAt(<span class="number">1</span><span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>white);
</pre>
<p>A gradient can have an arbitrary number of stop points. The
following would create a radial gradient starting with red in the
center, blue and then green on the edges:</p>
<pre class="cpp">
     <span class="type"><a href="qradialgradient.html">QRadialGradient</a></span> radialGrad(<span class="type"><a href="qpointf.html">QPointF</a></span>(<span class="number">100</span><span class="operator">,</span> <span class="number">100</span>)<span class="operator">,</span> <span class="number">100</span>);
     radialGrad<span class="operator">.</span>setColorAt(<span class="number">0</span><span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>red);
     radialGrad<span class="operator">.</span>setColorAt(<span class="number">0.5</span><span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>blue);
     radialGrad<span class="operator">.</span>setColorAt(<span class="number">1</span><span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>green);
</pre>
<p>It is possible to repeat or reflect the gradient outside its
area by specifiying the <a href="qgradient.html#Spread-enum">spread
method</a> using the <a href="qgradient.html#setSpread">setSpread</a>() function. The default is
to pad the outside area with the color at the closest stop point.
The currently set <a href="qgradient.html#Spread-enum">spread
method</a> can be retrieved using the <a href="qgradient.html#spread">spread</a>() function. The <a href="qgradient.html#Spread-enum">QGradient.Spread</a> enum defines
three different methods:</p>
<table class="generic">
<tr class="odd" valign="top">
<td><img alt="" src="images/qradialgradient-pad.png" /></td>
<td><img alt="" src="images/qradialgradient-repeat.png" /></td>
<td><img alt="" src="images/qradialgradient-reflect.png" /></td>
</tr>
<tr class="even" valign="top">
<td><a href="qgradient.html#Spread-enum">PadSpread</a></td>
<td><a href="qgradient.html#Spread-enum">RepeatSpread</a></td>
<td><a href="qgradient.html#Spread-enum">ReflectSpread</a></td>
</tr>
</table>
<p>Note that the <a href="qgradient.html#setSpread">setSpread</a>()
function only has effect for linear and radial gradients. The
reason is that the conical gradient is closed by definition, i.e.
the <i>conical</i> gradient fills the entire circle from 0 - 360
degrees, while the boundary of a radial or a linear gradient can be
specified through its radius or final stop points,
respectively.</p>
<p>The gradient coordinates can be specified in logical
coordinates, relative to device coordinates, or relative to object
bounding box coordinates. The <a href="qgradient.html#CoordinateMode-enum">coordinate mode</a> can be set
using the <a href="qgradient.html#setCoordinateMode">setCoordinateMode</a>()
function. The default is <a href="qgradient.html#CoordinateMode-enum">LogicalMode</a>, where the
gradient coordinates are specified in the same way as the object
coordinates. To retrieve the currently set <a href="qgradient.html#CoordinateMode-enum">coordinate mode</a> use
<a href="qgradient.html#coordinateMode">coordinateMode</a>().</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="CoordinateMode-enum" />QGradient.CoordinateMode</h3><p>This enum specifies how gradient coordinates map to the paint
device on which the gradient is used.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QGradient.LogicalMode</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">This is the default mode. The gradient
coordinates are specified logical space just like the object
coordinates.</td>
</tr>
<tr>
<td class="topAlign"><tt>QGradient.StretchToDeviceMode</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">In this mode the gradient coordinates are
relative to the bounding rectangle of the paint device, with (0,0)
in the top left corner, and (1,1) in the bottom right corner of the
paint device.</td>
</tr>
<tr>
<td class="topAlign"><tt>QGradient.ObjectBoundingMode</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">In this mode the gradient coordinates are
relative to the bounding rectangle of the object being drawn, with
(0,0) in the top left corner, and (1,1) in the bottom right corner
of the object's bounding rectangle.</td>
</tr>
</table>
<p>This enum was introduced or modified in Qt 4.4.</p>


<h3 class="fn"><a name="Spread-enum" />QGradient.Spread</h3><p>Specifies how the area outside the gradient area should be
filled.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QGradient.PadSpread</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">The area is filled with the closest stop
color. This is the default.</td>
</tr>
<tr>
<td class="topAlign"><tt>QGradient.RepeatSpread</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">The gradient is repeated outside the gradient
area.</td>
</tr>
<tr>
<td class="topAlign"><tt>QGradient.ReflectSpread</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">The gradient is reflected outside the gradient
area.</td>
</tr>
</table>
<p><b>See also</b> <a href="qgradient.html#spread">spread</a>() and
<a href="qgradient.html#setSpread">setSpread</a>().</p>


<h3 class="fn"><a name="Type-enum" />QGradient.Type</h3><p>Specifies the type of gradient.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QGradient.LinearGradient</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">Interpolates colors between start and end
points (<a href="qlineargradient.html">QLinearGradient</a>).</td>
</tr>
<tr>
<td class="topAlign"><tt>QGradient.RadialGradient</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">Interpolate colors between a focal point and
end points on a circle surrounding it (<a href="qradialgradient.html">QRadialGradient</a>).</td>
</tr>
<tr>
<td class="topAlign"><tt>QGradient.ConicalGradient</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">Interpolate colors around a center point
(<a href="qconicalgradient.html">QConicalGradient</a>).</td>
</tr>
<tr>
<td class="topAlign"><tt>QGradient.NoGradient</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign">No gradient is used.</td>
</tr>
</table>
<p><b>See also</b> <a href="qgradient.html#type">type</a>().</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QGradient" />QGradient.__init__ (<i>self</i>)</h3><h3 class="fn"><a name="QGradient-2" />QGradient.__init__ (<i>self</i>, <a href="qgradient.html">QGradient</a>)</h3><h3 class="fn"><a name="coordinateMode" /><a href="qgradient.html#CoordinateMode-enum">CoordinateMode</a> QGradient.coordinateMode (<i>self</i>)</h3><p>Returns the coordinate mode of this gradient. The default mode
is <a href="qgradient.html#CoordinateMode-enum">LogicalMode</a>.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qgradient.html#setCoordinateMode">setCoordinateMode</a>().</p>


<h3 class="fn"><a name="setColorAt" />QGradient.setColorAt (<i>self</i>, float&#160;<i>pos</i>, <a href="qcolor.html">QColor</a>&#160;<i>color</i>)</h3><p>Creates a stop point at the given <i>position</i> with the given
<i>color</i>. The given <i>position</i> must be in the range 0 to
1.</p>
<p><b>See also</b> <a href="qgradient.html#setStops">setStops</a>()
and <a href="qgradient.html#stops">stops</a>().</p>


<h3 class="fn"><a name="setCoordinateMode" />QGradient.setCoordinateMode (<i>self</i>, <a href="qgradient.html#CoordinateMode-enum">CoordinateMode</a>&#160;<i>mode</i>)</h3><p>Sets the coordinate mode of this gradient to <i>mode</i>. The
default mode is <a href="qgradient.html#CoordinateMode-enum">LogicalMode</a>.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qgradient.html#coordinateMode">coordinateMode</a>().</p>


<h3 class="fn"><a name="setSpread" />QGradient.setSpread (<i>self</i>, <a href="qgradient.html#Spread-enum">Spread</a>&#160;<i>aspread</i>)</h3><p>Specifies the spread <i>method</i> that should be used for this
gradient.</p>
<p>Note that this function only has effect for linear and radial
gradients.</p>
<p><b>See also</b> <a href="qgradient.html#spread">spread</a>().</p>


<h3 class="fn"><a name="setStops" />QGradient.setStops (<i>self</i>, list-of-tuple-of-float-QColor&#160;<i>stops</i>)</h3><p>Replaces the current set of stop points with the given
<i>stopPoints</i>. The positions of the points must be in the range
0 to 1, and must be sorted with the lowest point first.</p>
<p><b>See also</b> <a href="qgradient.html#setColorAt">setColorAt</a>() and <a href="qgradient.html#stops">stops</a>().</p>


<h3 class="fn"><a name="spread" /><a href="qgradient.html#Spread-enum">Spread</a> QGradient.spread (<i>self</i>)</h3><p>Returns the spread method use by this gradient. The default is
<a href="qgradient.html#Spread-enum">PadSpread</a>.</p>
<p><b>See also</b> <a href="qgradient.html#setSpread">setSpread</a>().</p>


<h3 class="fn"><a name="stops" />list-of-tuple-of-float-QColor QGradient.stops (<i>self</i>)</h3><p>Returns the stop points for this gradient.</p>
<p>If no stop points have been specified, a gradient of black at 0
to white at 1 is used.</p>
<p><b>See also</b> <a href="qgradient.html#setStops">setStops</a>()
and <a href="qgradient.html#setColorAt">setColorAt</a>().</p>


<h3 class="fn"><a name="type" /><a href="qgradient.html#Type-enum">Type</a> QGradient.type (<i>self</i>)</h3><p>Returns the type of gradient.</p>


<h3 class="fn"><a name="__eq__" />bool QGradient.__eq__ (<i>self</i>, <a href="qgradient.html">QGradient</a>&#160;<i>gradient</i>)</h3><h3 class="fn"><a name="__ne__" />bool QGradient.__ne__ (<i>self</i>, <a href="qgradient.html">QGradient</a>&#160;<i>other</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>