Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > e63754dc5af9f9ec95223fcea9485104 > files > 1762

python3-PyQt4-devel-4.8.3-2.fc14.x86_64.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>QPoint 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="../pyqt4ref.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">QPoint Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QPoint class defines a point in the plane using integer
precision. <a href="#details">More...</a></p>

<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qpoint.html#QPoint">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpoint.html#QPoint-2">__init__</a></b> (<i>self</i>, int&#160;<i>xpos</i>, int&#160;<i>ypos</i>)</li><li><div class="fn" /><b><a href="qpoint.html#QPoint-3">__init__</a></b> (<i>self</i>, QPoint)</li><li><div class="fn" />bool <b><a href="qpoint.html#isNull">isNull</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpoint.html#manhattanLength">manhattanLength</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpoint.html#setX">setX</a></b> (<i>self</i>, int&#160;<i>xpos</i>)</li><li><div class="fn" /><b><a href="qpoint.html#setY">setY</a></b> (<i>self</i>, int&#160;<i>ypos</i>)</li><li><div class="fn" />int <b><a href="qpoint.html#x">x</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpoint.html#y">y</a></b> (<i>self</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />QPoint <b><a href="qtgui.html#__mul__">__mul__</a></b> (<i>self</i>, QMatrix&#160;<i>m</i>)</li><li><div class="fn" />QPoint <b><a href="qtgui.html#__mul__-5">__mul__</a></b> (<i>self</i>, QMatrix4x4&#160;<i>matrix</i>)</li><li><div class="fn" />QPoint <b><a href="qtgui.html#__mul__-7">__mul__</a></b> (<i>self</i>, QTransform&#160;<i>m</i>)</li><li><div class="fn" />QPoint <b><a href="qpoint.html#__add__">__add__</a></b> (<i>self</i>, QPoint&#160;<i>p2</i>)</li><li><div class="fn" />int <b><a href="qpoint.html#__bool__">__bool__</a></b> (<i>self</i>)</li><li><div class="fn" />QPoint <b><a href="qpoint.html#__div__">__div__</a></b> (<i>self</i>, float&#160;<i>c</i>)</li><li><div class="fn" />bool <b><a href="qpoint.html#__eq__">__eq__</a></b> (<i>self</i>, QPoint&#160;<i>p2</i>)</li><li><div class="fn" />QPoint <b><a href="qpoint.html#__iadd__">__iadd__</a></b> (<i>self</i>, QPoint&#160;<i>p</i>)</li><li><div class="fn" />QPoint <b><a href="qpoint.html#__idiv__">__idiv__</a></b> (<i>self</i>, float&#160;<i>c</i>)</li><li><div class="fn" />QPoint <b><a href="qpoint.html#__imul__">__imul__</a></b> (<i>self</i>, float&#160;<i>c</i>)</li><li><div class="fn" />QPoint <b><a href="qpoint.html#__isub__">__isub__</a></b> (<i>self</i>, QPoint&#160;<i>p</i>)</li><li><div class="fn" />QPoint <b><a href="qpoint.html#__mul__">__mul__</a></b> (<i>self</i>, float&#160;<i>c</i>)</li><li><div class="fn" />bool <b><a href="qpoint.html#__ne__">__ne__</a></b> (<i>self</i>, QPoint&#160;<i>p2</i>)</li><li><div class="fn" />QPoint <b><a href="qpoint.html#__neg__">__neg__</a></b> (<i>self</i>)</li><li><div class="fn" />str <b><a href="qpoint.html#__repr__">__repr__</a></b> (<i>self</i>)</li><li><div class="fn" />QPoint <b><a href="qpoint.html#__sub__">__sub__</a></b> (<i>self</i>, QPoint&#160;<i>p2</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>This class can be pickled.</p><p>The QPoint class defines a point in the plane using integer
precision.</p>
<p>A point is specified by a x coordinate and an y coordinate which
can be accessed using the <a href="qpoint.html#x">x</a>() and
<a href="qpoint.html#y">y</a>() functions. The <a href="qpoint.html#isNull">isNull</a>() function returns true if both x
and y are set to 0. The coordinates can be set (or altered) using
the <a href="qpoint.html#setX">setX</a>() and <a href="qpoint.html#setY">setY</a>() functions, or alternatively the
<a href="qpoint.html#rx">rx</a>() and <a href="qpoint.html#ry">ry</a>() functions which return references to the
coordinates (allowing direct manipulation).</p>
<p>Given a point <i>p</i>, the following statements are all
equivalent:</p>
<pre class="highlightedCode brush: cpp">
 QPoint p;

 p.setX(p.x() + 1);
 p += QPoint(1, 0);
 p.rx()++;
</pre>
<p>A QPoint object can also be used as a vector: Addition and
subtraction are defined as for vectors (each component is added
separately). A QPoint object can also be divided or multiplied by
an <tt>int</tt> or a <tt>qreal</tt>.</p>
<p>In addition, the QPoint class provides the <a href="qpoint.html#manhattanLength">manhattanLength</a>() function which
gives an inexpensive approximation of the length of the QPoint
object interpreted as a vector. Finally, QPoint objects can be
streamed as well as compared.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QPoint" />QPoint.__init__ (<i>self</i>)</h3><p>Constructs a null point, i.e. with coordinates (0, 0)</p>
<p>See also <a href="qpoint.html#isNull">isNull</a>().</p>


<h3 class="fn"><a name="QPoint-2" />QPoint.__init__ (<i>self</i>, int&#160;<i>xpos</i>, int&#160;<i>ypos</i>)</h3><p>Constructs a point with the given coordinates (<i>x</i>,
<i>y</i>).</p>
<p>See also <a href="qpoint.html#setX">setX</a>() and <a href="qpoint.html#setY">setY</a>().</p>


<h3 class="fn"><a name="QPoint-3" />QPoint.__init__ (<i>self</i>, <a href="qpoint.html">QPoint</a>)</h3><h3 class="fn"><a name="isNull" />bool QPoint.isNull (<i>self</i>)</h3><p>Returns true if both the x and y coordinates are set to 0,
otherwise returns false.</p>


<h3 class="fn"><a name="manhattanLength" />int QPoint.manhattanLength (<i>self</i>)</h3><p>Returns the sum of the absolute values of <a href="qpoint.html#x">x</a>() and <a href="qpoint.html#y">y</a>(),
traditionally known as the "Manhattan length" of the vector from
the origin to the point. For example:</p>
<pre class="highlightedCode brush: cpp">
 QPoint oldPosition;

 MyWidget.mouseMoveEvent(QMouseEvent *event)
 {
     QPoint point = event-&gt;pos() - oldPosition;
     if (point.manhattanLength() &gt; 3)
         <span class="comment">// the mouse has moved more than 3 pixels since the oldPosition</span>
 }
</pre>
<p>This is a useful, and quick to calculate, approximation to the
true length:</p>
<pre class="highlightedCode brush: cpp">
 double trueLength = sqrt(pow(x(), 2) + pow(y(), 2));
</pre>
<p>The tradition of "Manhattan length" arises because such
distances apply to travelers who can only travel on a rectangular
grid, like the streets of Manhattan.</p>


<h3 class="fn"><a name="setX" />QPoint.setX (<i>self</i>, int&#160;<i>xpos</i>)</h3><p>Sets the x coordinate of this point to the given <i>x</i>
coordinate.</p>
<p>See also <a href="qpoint.html#x">x</a>() and <a href="qpoint.html#setY">setY</a>().</p>


<h3 class="fn"><a name="setY" />QPoint.setY (<i>self</i>, int&#160;<i>ypos</i>)</h3><p>Sets the y coordinate of this point to the given <i>y</i>
coordinate.</p>
<p>See also <a href="qpoint.html#y">y</a>() and <a href="qpoint.html#setX">setX</a>().</p>


<h3 class="fn"><a name="x" />int QPoint.x (<i>self</i>)</h3><p>Returns the x coordinate of this point.</p>
<p>See also <a href="qpoint.html#setX">setX</a>() and <a href="qpoint.html#rx">rx</a>().</p>


<h3 class="fn"><a name="y" />int QPoint.y (<i>self</i>)</h3><p>Returns the y coordinate of this point.</p>
<p>See also <a href="qpoint.html#setY">setY</a>() and <a href="qpoint.html#ry">ry</a>().</p>


<h3 class="fn"><a name="__mul__" /><a href="qpoint.html">QPoint</a> __mul__ (<i>self</i>, <a href="qmatrix.html">QMatrix</a>&#160;<i>m</i>)</h3><p>This method is only available if the QtGui module is imported.</p><h3 class="fn"><a name="__mul__-5" /><a href="qpoint.html">QPoint</a> __mul__ (<i>self</i>, <a href="qmatrix4x4.html">QMatrix4x4</a>&#160;<i>matrix</i>)</h3><p>This method is only available if the QtGui module is imported.</p><h3 class="fn"><a name="__mul__-7" /><a href="qpoint.html">QPoint</a> __mul__ (<i>self</i>, <a href="qtransform.html">QTransform</a>&#160;<i>m</i>)</h3><p>This method is only available if the QtGui module is imported.</p><h3 class="fn"><a name="__add__" /><a href="qpoint.html">QPoint</a> QPoint.__add__ (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p2</i>)</h3><h3 class="fn"><a name="__bool__" />int QPoint.__bool__ (<i>self</i>)</h3><h3 class="fn"><a name="__div__" /><a href="qpoint.html">QPoint</a> QPoint.__div__ (<i>self</i>, float&#160;<i>c</i>)</h3><h3 class="fn"><a name="__eq__" />bool QPoint.__eq__ (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p2</i>)</h3><h3 class="fn"><a name="__iadd__" /><a href="qpoint.html">QPoint</a> QPoint.__iadd__ (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p</i>)</h3><h3 class="fn"><a name="__idiv__" /><a href="qpoint.html">QPoint</a> QPoint.__idiv__ (<i>self</i>, float&#160;<i>c</i>)</h3><h3 class="fn"><a name="__imul__" /><a href="qpoint.html">QPoint</a> QPoint.__imul__ (<i>self</i>, float&#160;<i>c</i>)</h3><h3 class="fn"><a name="__isub__" /><a href="qpoint.html">QPoint</a> QPoint.__isub__ (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p</i>)</h3><h3 class="fn"><a name="__mul__" /><a href="qpoint.html">QPoint</a> QPoint.__mul__ (<i>self</i>, float&#160;<i>c</i>)</h3><h3 class="fn"><a name="__ne__" />bool QPoint.__ne__ (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p2</i>)</h3><h3 class="fn"><a name="__neg__" /><a href="qpoint.html">QPoint</a> QPoint.__neg__ (<i>self</i>)</h3><h3 class="fn"><a name="__repr__" />str QPoint.__repr__ (<i>self</i>)</h3><h3 class="fn"><a name="__sub__" /><a href="qpoint.html">QPoint</a> QPoint.__sub__ (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p2</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.8.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> 2011</td><td align="right" width="25%">Qt&#160;4.7.1</td></tr></table></div></address></body></html>