<class name="QPoint" doc="/** <p>The <a href="QPoint.html#QPoint(int, int)"><tt>QPoint</tt></a> 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()"><tt>x</tt></a> and <a href="QPoint.html#y()"><tt>y</tt></a> functions. The <a href="QPoint.html#isNull()"><tt>isNull</tt></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(int)"><tt>setX</tt></a> and <a href="QPoint.html#setY(int)"><tt>setY</tt></a> functions, or alternatively the rx() and ry() 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> QPoint p; p.setX(p.x() + 1); p += QPoint(1, 0); p.rx()++;</pre> <p>A <a href="QPoint.html#QPoint(int, int)"><tt>QPoint</tt></a> object can also be used as a vector: Addition and subtraction are defined as for vectors (each component is added separately). A <a href="QPoint.html#QPoint(int, int)"><tt>QPoint</tt></a> object can also be divided or multiplied by an <tt>int</tt> or a <tt>qreal</tt>.</p> <p>In addition, the <a href="QPoint.html#QPoint(int, int)"><tt>QPoint</tt></a> class provides the <a href="QPoint.html#manhattanLength()"><tt>manhattanLength</tt></a> function which gives an inexpensive approximation of the length of the <a href="QPoint.html#QPoint(int, int)"><tt>QPoint</tt></a> object interpreted as a vector. Finally, <a href="QPoint.html#QPoint(int, int)"><tt>QPoint</tt></a> objects can be streamed as well as compared.</p> @see <a href="QPointF.html"><tt>QPointF</tt></a> @see <a href="%2E%2E/gui/QPolygon.html"><tt>QPolygon</tt></a> */"> <method name="public QPoint()" doc="/** <p>Constructs a null point, i.e&#x2e; with coordinates (0, 0)</p> @see <a href="QPoint.html#isNull()"><tt>isNull</tt></a> */"/> <method name="public QPoint(int xpos, int ypos)" doc="/** <p>Constructs a point with the given coordinates (<tt>xpos</tt>, <tt>ypos</tt>).</p> @see <a href="QPoint.html#setX(int)"><tt>setX</tt></a> @see <a href="QPoint.html#setY(int)"><tt>setY</tt></a> */"/> <method name="public final boolean isNull()" doc="/** <p>Returns true if both the x and y coordinates are set to 0, otherwise returns false.</p> */"/> <method name="public final int manhattanLength()" doc="/** <p>Returns the sum of the absolute values of <a href="QPoint.html#x()"><tt>x</tt></a> and <a href="QPoint.html#y()"><tt>y</tt></a>, traditionally known as the &quot;Manhattan length&quot; of the vector from the origin to the point. For example:</p> <pre> 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> int trueManhattenLength = sqrt(pow(x(), 2) + pow(y(), 2));</pre> <p>The tradition of &quot;Manhattan length&quot; arises because such distances apply to travelers who can only travel on a rectangular grid, like the streets of Manhattan.</p> */"/> <method name="public final void writeTo(com.trolltech.qt.core.QDataStream arg__1)"/> <method name="public final void readFrom(com.trolltech.qt.core.QDataStream arg__1)"/> <method name="public final void setX(int x)" doc="/** <p>Sets the x coordinate of this point to the given <tt>x</tt> coordinate.</p> @see <a href="QPoint.html#x()"><tt>x</tt></a> @see <a href="QPoint.html#setY(int)"><tt>setY</tt></a> */"/> <method name="public final void setY(int y)" doc="/** <p>Sets the y coordinate of this point to the given <tt>y</tt> coordinate.</p> @see <a href="QPoint.html#y()"><tt>y</tt></a> @see <a href="QPoint.html#setX(int)"><tt>setX</tt></a> */"/> <method name="public final int x()" doc="/** <p>Returns the x coordinate of this point.</p> @see <a href="QPoint.html#setX(int)"><tt>setX</tt></a> @see <tt>rx</tt> */"/> <method name="public final int y()" doc="/** <p>Returns the y coordinate of this point.</p> @see <a href="QPoint.html#setY(int)"><tt>setY</tt></a> @see <tt>ry</tt> */"/> </class>