<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qpoint.cpp --> <title>QPointF Class | Qt Core 5.12.6</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td >Qt 5.12</td><td ><a href="qtcore-index.html">Qt Core</a></td><td ><a href="qtcore-module.html">C++ Classes</a></td><td >QPointF</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right"><a href="qtcore-index.html">Qt 5.12.6 Reference Documentation</a></td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <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="#static-public-members">Static Public Members</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> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QPointF Class</h1> <!-- $$$QPointF-brief --> <p>The <a href="qpointf.html">QPointF</a> class defines a point in the plane using floating point precision. <a href="#details">More...</a></p> <!-- @@@QPointF --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QPointF></span> </td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += core</td></tr></table></div><ul> <li><a href="qpointf-members.html">List of all members, including inherited members</a></li> </ul> <p><b>Note:</b> All functions in this class are reentrant.</p> <a name="public-functions"></a> <h2 id="public-functions">Public Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#QPointF">QPointF</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#QPointF-1">QPointF</a></b>(const QPoint &<i>point</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#QPointF-2">QPointF</a></b>(qreal <i>xpos</i>, qreal <i>ypos</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#isNull">isNull</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#manhattanLength">manhattanLength</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> qreal &</td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#rx">rx</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> qreal &</td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#ry">ry</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#setX">setX</a></b>(qreal <i>x</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#setY">setY</a></b>(qreal <i>y</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> CGPoint </td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#toCGPoint">toCGPoint</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QPoint </td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#toPoint">toPoint</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#x">x</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#y">y</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QPointF &</td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#operator-2a-eq">operator*=</a></b>(qreal <i>factor</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QPointF &</td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#operator-2b-eq">operator+=</a></b>(const QPointF &<i>point</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QPointF &</td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#operator--eq">operator-=</a></b>(const QPointF &<i>point</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QPointF &</td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#operator-2f-eq">operator/=</a></b>(qreal <i>divisor</i>)</td></tr> </table></div> <a name="static-public-members"></a> <h2 id="static-public-members">Static Public Members</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#dotProduct">dotProduct</a></b>(const QPointF &<i>p1</i>, const QPointF &<i>p2</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QPointF </td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#fromCGPoint">fromCGPoint</a></b>(CGPoint <i>point</i>)</td></tr> </table></div> <a name="related-non-members"></a> <h2 id="related-non-members">Related Non-Members</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#operator-not-eq">operator!=</a></b>(const QPointF &<i>p1</i>, const QPointF &<i>p2</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> const QPointF </td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#operator-2a">operator*</a></b>(const QPointF &<i>point</i>, qreal <i>factor</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> const QPointF </td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#operator-2a-1">operator*</a></b>(qreal <i>factor</i>, const QPointF &<i>point</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> const QPointF </td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#operator-2b">operator+</a></b>(const QPointF &<i>p1</i>, const QPointF &<i>p2</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> const QPointF </td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#operator-2b-1">operator+</a></b>(const QPointF &<i>point</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> const QPointF </td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#operator-">operator-</a></b>(const QPointF &<i>p1</i>, const QPointF &<i>p2</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> const QPointF </td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#operator--1">operator-</a></b>(const QPointF &<i>point</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> const QPointF </td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#operator-2f">operator/</a></b>(const QPointF &<i>point</i>, qreal <i>divisor</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QDataStream &</td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#operator-lt-lt">operator<<</a></b>(QDataStream &<i>stream</i>, const QPointF &<i>point</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#operator-eq-eq">operator==</a></b>(const QPointF &<i>p1</i>, const QPointF &<i>p2</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QDataStream &</td><td class="memItemRight bottomAlign"><b><a href="qpointf.html#operator-gt-gt">operator>></a></b>(QDataStream &<i>stream</i>, QPointF &<i>point</i>)</td></tr> </table></div> <a name="details"></a> <!-- $$$QPointF-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qpointf.html">QPointF</a> class defines a point in the plane using floating point precision.</p> <p>A point is specified by a x coordinate and an y coordinate which can be accessed using the <a href="qpointf.html#x">x</a>() and <a href="qpointf.html#y">y</a>() functions. The coordinates of the point are specified using floating point numbers for accuracy. The <a href="qpointf.html#isNull">isNull</a>() function returns <code>true</code> if both x and y are set to 0.0. The coordinates can be set (or altered) using the <a href="qpointf.html#setX">setX</a>() and <a href="qpointf.html#setY">setY</a>() functions, or alternatively the <a href="qpointf.html#rx">rx</a>() and <a href="qpointf.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="cpp"> <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> p; p<span class="operator">.</span>setX(p<span class="operator">.</span>x() <span class="operator">+</span> <span class="number">1.0</span>); p <span class="operator">+</span><span class="operator">=</span> <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span>(<span class="number">1.0</span><span class="operator">,</span> <span class="number">0.0</span>); p<span class="operator">.</span>rx()<span class="operator">+</span><span class="operator">+</span>; </pre> <p>A <a href="qpointf.html">QPointF</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="qpointf.html">QPointF</a> object can also be divided or multiplied by an <code>int</code> or a <code>qreal</code>.</p> <p>In addition, the <a href="qpointf.html">QPointF</a> class provides a constructor converting a <a href="qpoint.html">QPoint</a> object into a <a href="qpointf.html">QPointF</a> object, and a corresponding <a href="qpointf.html#toPoint">toPoint</a>() function which returns a <a href="qpoint.html">QPoint</a> copy of <i>this</i> point. Finally, <a href="qpointf.html">QPointF</a> objects can be streamed as well as compared.</p> </div> <p><b>See also </b><a href="qpoint.html">QPoint</a> and <a href="../qtgui/qpolygonf.html">QPolygonF</a>.</p> <!-- @@@QPointF --> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QPointF[overload1]$$$QPointF --> <h3 class="fn" id="QPointF"><a name="QPointF"></a>QPointF::<span class="name">QPointF</span>()</h3> <p>Constructs a null point, i.e. with coordinates (0.0, 0.0)</p> <p><b>See also </b><a href="qpointf.html#isNull">isNull</a>().</p> <!-- @@@QPointF --> <!-- $$$QPointF$$$QPointFconstQPoint& --> <h3 class="fn" id="QPointF-1"><a name="QPointF-1"></a>QPointF::<span class="name">QPointF</span>(const <span class="type"><a href="qpoint.html">QPoint</a></span> &<i>point</i>)</h3> <p>Constructs a copy of the given <i>point</i>.</p> <p><b>See also </b><a href="qpointf.html#toPoint">toPoint</a>().</p> <!-- @@@QPointF --> <!-- $$$QPointF$$$QPointFqrealqreal --> <h3 class="fn" id="QPointF-2"><a name="QPointF-2"></a>QPointF::<span class="name">QPointF</span>(<span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>xpos</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>ypos</i>)</h3> <p>Constructs a point with the given coordinates (<i>xpos</i>, <i>ypos</i>).</p> <p><b>See also </b><a href="qpointf.html#setX">setX</a>() and <a href="qpointf.html#setY">setY</a>().</p> <!-- @@@QPointF --> <!-- $$$dotProduct[overload1]$$$dotProductconstQPointF&constQPointF& --> <h3 class="fn" id="dotProduct"><a name="dotProduct"></a><code>[static] </code><span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> QPointF::<span class="name">dotProduct</span>(const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &<i>p1</i>, const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &<i>p2</i>)</h3> <pre class="cpp"> <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> p( <span class="number">3.1</span><span class="operator">,</span> <span class="number">7.1</span>); <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> q(<span class="operator">-</span><span class="number">1.0</span><span class="operator">,</span> <span class="number">4.1</span>); <span class="type">int</span> lengthSquared <span class="operator">=</span> <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span><span class="operator">::</span>dotProduct(p<span class="operator">,</span> q); <span class="comment">// lengthSquared becomes 26.01</span> </pre> <p>Returns the dot product of <i>p1</i> and <i>p2</i>.</p> <p>This function was introduced in Qt 5.1.</p> <!-- @@@dotProduct --> <!-- $$$fromCGPoint[overload1]$$$fromCGPointCGPoint --> <h3 class="fn" id="fromCGPoint"><a name="fromCGPoint"></a><code>[static] </code><span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> QPointF::<span class="name">fromCGPoint</span>(<span class="type">CGPoint</span> <i>point</i>)</h3> <p>Creates a <a href="qrectf.html">QRectF</a> from CGPoint <i>point</i>.</p> <p>This function was introduced in Qt 5.8.</p> <p><b>See also </b><a href="qpointf.html#toCGPoint">toCGPoint</a>().</p> <!-- @@@fromCGPoint --> <!-- $$$isNull[overload1]$$$isNull --> <h3 class="fn" id="isNull"><a name="isNull"></a><span class="type">bool</span> QPointF::<span class="name">isNull</span>() const</h3> <p>Returns <code>true</code> if both the x and y coordinates are set to 0.0 (ignoring the sign); otherwise returns <code>false</code>.</p> <!-- @@@isNull --> <!-- $$$manhattanLength[overload1]$$$manhattanLength --> <h3 class="fn" id="manhattanLength"><a name="manhattanLength"></a><span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> QPointF::<span class="name">manhattanLength</span>() const</h3> <p>Returns the sum of the absolute values of <a href="qpointf.html#x">x</a>() and <a href="qpointf.html#y">y</a>(), traditionally known as the "Manhattan length" of the vector from the origin to the point.</p> <p>This function was introduced in Qt 4.6.</p> <p><b>See also </b><a href="qpoint.html#manhattanLength">QPoint::manhattanLength</a>().</p> <!-- @@@manhattanLength --> <!-- $$$rx[overload1]$$$rx --> <h3 class="fn" id="rx"><a name="rx"></a><span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> &QPointF::<span class="name">rx</span>()</h3> <p>Returns a reference to the x coordinate of this point.</p> <p>Using a reference makes it possible to directly manipulate x. For example:</p> <pre class="cpp"> <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> p(<span class="number">1.1</span><span class="operator">,</span> <span class="number">2.5</span>); p<span class="operator">.</span>rx()<span class="operator">-</span><span class="operator">-</span>; <span class="comment">// p becomes (0.1, 2.5)</span> </pre> <p><b>See also </b><a href="qpointf.html#x">x</a>() and <a href="qpointf.html#setX">setX</a>().</p> <!-- @@@rx --> <!-- $$$ry[overload1]$$$ry --> <h3 class="fn" id="ry"><a name="ry"></a><span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> &QPointF::<span class="name">ry</span>()</h3> <p>Returns a reference to the y coordinate of this point.</p> <p>Using a reference makes it possible to directly manipulate y. For example:</p> <pre class="cpp"> <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> p(<span class="number">1.1</span><span class="operator">,</span> <span class="number">2.5</span>); p<span class="operator">.</span>ry()<span class="operator">+</span><span class="operator">+</span>; <span class="comment">// p becomes (1.1, 3.5)</span> </pre> <p><b>See also </b><a href="qpointf.html#y">y</a>() and <a href="qpointf.html#setY">setY</a>().</p> <!-- @@@ry --> <!-- $$$setX[overload1]$$$setXqreal --> <h3 class="fn" id="setX"><a name="setX"></a><span class="type">void</span> QPointF::<span class="name">setX</span>(<span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>x</i>)</h3> <p>Sets the x coordinate of this point to the given <i>x</i> coordinate.</p> <p><b>See also </b><a href="qpointf.html#x">x</a>() and <a href="qpointf.html#setY">setY</a>().</p> <!-- @@@setX --> <!-- $$$setY[overload1]$$$setYqreal --> <h3 class="fn" id="setY"><a name="setY"></a><span class="type">void</span> QPointF::<span class="name">setY</span>(<span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>y</i>)</h3> <p>Sets the y coordinate of this point to the given <i>y</i> coordinate.</p> <p><b>See also </b><a href="qpointf.html#y">y</a>() and <a href="qpointf.html#setX">setX</a>().</p> <!-- @@@setY --> <!-- $$$toCGPoint[overload1]$$$toCGPoint --> <h3 class="fn" id="toCGPoint"><a name="toCGPoint"></a><span class="type">CGPoint</span> QPointF::<span class="name">toCGPoint</span>() const</h3> <p>Creates a CGPoint from a <a href="qpointf.html">QPointF</a>.</p> <p>This function was introduced in Qt 5.8.</p> <p><b>See also </b><a href="qpointf.html#fromCGPoint">fromCGPoint</a>().</p> <!-- @@@toCGPoint --> <!-- $$$toPoint[overload1]$$$toPoint --> <h3 class="fn" id="toPoint"><a name="toPoint"></a><span class="type"><a href="qpoint.html">QPoint</a></span> QPointF::<span class="name">toPoint</span>() const</h3> <p>Rounds the coordinates of this point to the nearest integer, and returns a <a href="qpoint.html">QPoint</a> object with the rounded coordinates.</p> <p><b>See also </b><a href="qpointf.html#QPointF">QPointF</a>().</p> <!-- @@@toPoint --> <!-- $$$x[overload1]$$$x --> <h3 class="fn" id="x"><a name="x"></a><span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> QPointF::<span class="name">x</span>() const</h3> <p>Returns the x coordinate of this point.</p> <p><b>See also </b><a href="qpointf.html#setX">setX</a>() and <a href="qpointf.html#rx">rx</a>().</p> <!-- @@@x --> <!-- $$$y[overload1]$$$y --> <h3 class="fn" id="y"><a name="y"></a><span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> QPointF::<span class="name">y</span>() const</h3> <p>Returns the y coordinate of this point.</p> <p><b>See also </b><a href="qpointf.html#setY">setY</a>() and <a href="qpointf.html#ry">ry</a>().</p> <!-- @@@y --> <!-- $$$operator*=[overload1]$$$operator*=qreal --> <h3 class="fn" id="operator-2a-eq"><a name="operator-2a-eq"></a><span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &QPointF::<span class="name">operator*=</span>(<span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>factor</i>)</h3> <p>Multiplies this point's coordinates by the given <i>factor</i>, and returns a reference to this point. For example:</p> <pre class="cpp"> <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> p(<span class="operator">-</span><span class="number">1.1</span><span class="operator">,</span> <span class="number">4.1</span>); p <span class="operator">*</span><span class="operator">=</span> <span class="number">2.5</span>; <span class="comment">// p becomes (-2.75, 10.25)</span> </pre> <p><b>See also </b><a href="qpointf.html#operator-2f-eq">operator/=</a>().</p> <!-- @@@operator*= --> <!-- $$$operator+=[overload1]$$$operator+=constQPointF& --> <h3 class="fn" id="operator-2b-eq"><a name="operator-2b-eq"></a><span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &QPointF::<span class="name">operator+=</span>(const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &<i>point</i>)</h3> <p>Adds the given <i>point</i> to this point and returns a reference to this point. For example:</p> <pre class="cpp"> <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> p( <span class="number">3.1</span><span class="operator">,</span> <span class="number">7.1</span>); <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> q(<span class="operator">-</span><span class="number">1.0</span><span class="operator">,</span> <span class="number">4.1</span>); p <span class="operator">+</span><span class="operator">=</span> q; <span class="comment">// p becomes (2.1, 11.2)</span> </pre> <p><b>See also </b><a href="qpointf.html#operator--eq">operator-=</a>().</p> <!-- @@@operator+= --> <!-- $$$operator-=[overload1]$$$operator-=constQPointF& --> <h3 class="fn" id="operator--eq"><a name="operator--eq"></a><span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &QPointF::<span class="name">operator-=</span>(const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &<i>point</i>)</h3> <p>Subtracts the given <i>point</i> from this point and returns a reference to this point. For example:</p> <pre class="cpp"> <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> p( <span class="number">3.1</span><span class="operator">,</span> <span class="number">7.1</span>); <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> q(<span class="operator">-</span><span class="number">1.0</span><span class="operator">,</span> <span class="number">4.1</span>); p <span class="operator">-</span><span class="operator">=</span> q; <span class="comment">// p becomes (4.1, 3.0)</span> </pre> <p><b>See also </b><a href="qpointf.html#operator-2b-eq">operator+=</a>().</p> <!-- @@@operator-= --> <!-- $$$operator/=[overload1]$$$operator/=qreal --> <h3 class="fn" id="operator-2f-eq"><a name="operator-2f-eq"></a><span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &QPointF::<span class="name">operator/=</span>(<span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>divisor</i>)</h3> <p>Divides both x and y by the given <i>divisor</i>, and returns a reference to this point. For example:</p> <pre class="cpp"> <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> p(<span class="operator">-</span><span class="number">2.75</span><span class="operator">,</span> <span class="number">10.25</span>); p <span class="operator">/</span><span class="operator">=</span> <span class="number">2.5</span>; <span class="comment">// p becomes (-1.1, 4.1)</span> </pre> <p><b>See also </b><a href="qpointf.html#operator-2a-eq">operator*=</a>().</p> <!-- @@@operator/= --> </div> <div class="relnonmem"> <h2>Related Non-Members</h2> <!-- $$$operator!=[overload1]$$$operator!=constQPointF&constQPointF& --> <h3 class="fn" id="operator-not-eq"><a name="operator-not-eq"></a><span class="type">bool</span> <span class="name">operator!=</span>(const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &<i>p1</i>, const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &<i>p2</i>)</h3> <p>Returns <code>true</code> if <i>p1</i> is not equal to <i>p2</i>; otherwise returns <code>false</code>.</p> <!-- @@@operator!= --> <!-- $$$operator*[overload1]$$$operator*constQPointF&qreal --> <h3 class="fn" id="operator-2a"><a name="operator-2a"></a>const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> <span class="name">operator*</span>(const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &<i>point</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>factor</i>)</h3> <p>Returns a copy of the given <i>point</i>, multiplied by the given <i>factor</i>.</p> <p><b>See also </b><a href="qpointf.html#operator-2a-eq">QPointF::operator*=</a>().</p> <!-- @@@operator* --> <!-- $$$operator*$$$operator*qrealconstQPointF& --> <h3 class="fn" id="operator-2a-1"><a name="operator-2a-1"></a>const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> <span class="name">operator*</span>(<span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>factor</i>, const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &<i>point</i>)</h3> <p>This is an overloaded function.</p> <p>Returns a copy of the given <i>point</i>, multiplied by the given <i>factor</i>.</p> <!-- @@@operator* --> <!-- $$$operator+[overload1]$$$operator+constQPointF&constQPointF& --> <h3 class="fn" id="operator-2b"><a name="operator-2b"></a>const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> <span class="name">operator+</span>(const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &<i>p1</i>, const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &<i>p2</i>)</h3> <p>Returns a <a href="qpointf.html">QPointF</a> object that is the sum of the given points, <i>p1</i> and <i>p2</i>; each component is added separately.</p> <p><b>See also </b><a href="qpointf.html#operator-2b-eq">QPointF::operator+=</a>().</p> <!-- @@@operator+ --> <!-- $$$operator+$$$operator+constQPointF& --> <h3 class="fn" id="operator-2b-1"><a name="operator-2b-1"></a>const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> <span class="name">operator+</span>(const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &<i>point</i>)</h3> <p>Returns <i>point</i> unmodified.</p> <p>This function was introduced in Qt 5.0.</p> <!-- @@@operator+ --> <!-- $$$operator-[overload1]$$$operator-constQPointF&constQPointF& --> <h3 class="fn" id="operator-"><a name="operator-"></a>const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> <span class="name">operator-</span>(const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &<i>p1</i>, const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &<i>p2</i>)</h3> <p>Returns a <a href="qpointf.html">QPointF</a> object that is formed by subtracting <i>p2</i> from <i>p1</i>; each component is subtracted separately.</p> <p><b>See also </b><a href="qpointf.html#operator--eq">QPointF::operator-=</a>().</p> <!-- @@@operator- --> <!-- $$$operator-$$$operator-constQPointF& --> <h3 class="fn" id="operator--1"><a name="operator--1"></a>const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> <span class="name">operator-</span>(const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &<i>point</i>)</h3> <p>This is an overloaded function.</p> <p>Returns a <a href="qpointf.html">QPointF</a> object that is formed by changing the sign of both components of the given <i>point</i>.</p> <p>Equivalent to <code>QPointF(0,0) - point</code>.</p> <!-- @@@operator- --> <!-- $$$operator/[overload1]$$$operator/constQPointF&qreal --> <h3 class="fn" id="operator-2f"><a name="operator-2f"></a>const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> <span class="name">operator/</span>(const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &<i>point</i>, <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>divisor</i>)</h3> <p>Returns the <a href="qpointf.html">QPointF</a> object formed by dividing both components of the given <i>point</i> by the given <i>divisor</i>.</p> <p><b>See also </b><a href="qpointf.html#operator-2f-eq">QPointF::operator/=</a>().</p> <!-- @@@operator/ --> <!-- $$$operator<<[overload1]$$$operator<<QDataStream&constQPointF& --> <h3 class="fn" id="operator-lt-lt"><a name="operator-lt-lt"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &<span class="name">operator<<</span>(<span class="type"><a href="qdatastream.html">QDataStream</a></span> &<i>stream</i>, const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &<i>point</i>)</h3> <p>Writes the given <i>point</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==[overload1]$$$operator==constQPointF&constQPointF& --> <h3 class="fn" id="operator-eq-eq"><a name="operator-eq-eq"></a><span class="type">bool</span> <span class="name">operator==</span>(const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &<i>p1</i>, const <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &<i>p2</i>)</h3> <p>Returns <code>true</code> if <i>p1</i> is equal to <i>p2</i>; otherwise returns <code>false</code>.</p> <!-- @@@operator== --> <!-- $$$operator>>[overload1]$$$operator>>QDataStream&QPointF& --> <h3 class="fn" id="operator-gt-gt"><a name="operator-gt-gt"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &<span class="name">operator>></span>(<span class="type"><a href="qdatastream.html">QDataStream</a></span> &<i>stream</i>, <span class="type"><a href="qpointf.html#QPointF">QPointF</a></span> &<i>point</i>)</h3> <p>Reads a point from the given <i>stream</i> into the given <i>point</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> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2019 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br/> 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.<br/> 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. </p> </div> </body> </html>