467 lines
36 KiB
HTML
467 lines
36 KiB
HTML
<?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" />
|
|
<!-- qpoint.cpp -->
|
|
<title>Qt 4.8: QPoint Class Reference</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 & 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> 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 & 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="modules.html">Modules</a></li>
|
|
<li><a href="qtcore.html">QtCore</a></li>
|
|
<li>QPoint</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">
|
|
<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="#related-non-members">Related Non-Members</a></li>
|
|
<li class="level1"><a href="#details">Detailed Description</a></li>
|
|
</ul>
|
|
</div>
|
|
<h1 class="title">QPoint Class Reference</h1>
|
|
<!-- $$$QPoint-brief -->
|
|
<p>The QPoint class defines a point in the plane using integer precision. <a href="#details">More...</a></p>
|
|
<!-- @@@QPoint -->
|
|
<pre class="cpp"> <span class="preprocessor">#include <QPoint></span></pre><ul>
|
|
<li><a href="qpoint-members.html">List of all members, including inherited members</a></li>
|
|
</ul>
|
|
<a name="public-functions"></a>
|
|
<h2>Public Functions</h2>
|
|
<table class="alignedsummary">
|
|
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#QPoint">QPoint</a></b> ()</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#QPoint-2">QPoint</a></b> ( int <i>x</i>, int <i>y</i> )</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#isNull">isNull</a></b> () const</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#manhattanLength">manhattanLength</a></b> () const</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> int & </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#rx">rx</a></b> ()</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> int & </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#ry">ry</a></b> ()</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#setX">setX</a></b> ( int <i>x</i> )</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#setY">setY</a></b> ( int <i>y</i> )</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#x">x</a></b> () const</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#y">y</a></b> () const</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> QPoint & </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2a-eq">operator*=</a></b> ( float <i>factor</i> )</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> QPoint & </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2a-eq-2">operator*=</a></b> ( double <i>factor</i> )</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> QPoint & </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2a-eq-3">operator*=</a></b> ( int <i>factor</i> )</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> QPoint & </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2b-eq">operator+=</a></b> ( const QPoint & <i>point</i> )</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> QPoint & </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator--eq">operator-=</a></b> ( const QPoint & <i>point</i> )</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> QPoint & </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2f-eq">operator/=</a></b> ( qreal <i>divisor</i> )</td></tr>
|
|
</table>
|
|
<a name="related-non-members"></a>
|
|
<h2>Related Non-Members</h2>
|
|
<table class="alignedsummary">
|
|
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-not-eq-62">operator!=</a></b> ( const QPoint & <i>p1</i>, const QPoint & <i>p2</i> )</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> const QPoint </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2a-50">operator*</a></b> ( const QPoint & <i>point</i>, float <i>factor</i> )</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> const QPoint </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2a-51">operator*</a></b> ( const QPoint & <i>point</i>, double <i>factor</i> )</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> const QPoint </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2a-52">operator*</a></b> ( const QPoint & <i>point</i>, int <i>factor</i> )</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> const QPoint </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2a-54">operator*</a></b> ( float <i>factor</i>, const QPoint & <i>point</i> )</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> const QPoint </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2a-55">operator*</a></b> ( double <i>factor</i>, const QPoint & <i>point</i> )</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> const QPoint </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2a-56">operator*</a></b> ( int <i>factor</i>, const QPoint & <i>point</i> )</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> const QPoint </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2b-38">operator+</a></b> ( const QPoint & <i>p1</i>, const QPoint & <i>p2</i> )</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> const QPoint </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator--15">operator-</a></b> ( const QPoint & <i>p1</i>, const QPoint & <i>p2</i> )</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> const QPoint </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator--18">operator-</a></b> ( const QPoint & <i>point</i> )</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> const QPoint </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-2f-9">operator/</a></b> ( const QPoint & <i>point</i>, qreal <i>divisor</i> )</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream & </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-lt-lt-202">operator<<</a></b> ( QDataStream & <i>stream</i>, const QPoint & <i>point</i> )</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-eq-eq-90">operator==</a></b> ( const QPoint & <i>p1</i>, const QPoint & <i>p2</i> )</td></tr>
|
|
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream & </td><td class="memItemRight bottomAlign"><b><a href="qpoint.html#operator-gt-gt-111">operator>></a></b> ( QDataStream & <i>stream</i>, QPoint & <i>point</i> )</td></tr>
|
|
</table>
|
|
<a name="details"></a>
|
|
<!-- $$$QPoint-description -->
|
|
<div class="descr">
|
|
<h2>Detailed Description</h2>
|
|
<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="cpp"> <span class="type">QPoint</span> p;
|
|
|
|
p<span class="operator">.</span><a href="qpoint.html#setX">setX</a>(p<span class="operator">.</span>x() <span class="operator">+</span> <span class="number">1</span>);
|
|
p <span class="operator">+</span><span class="operator">=</span> <span class="type">QPoint</span>(<span class="number">1</span><span class="operator">,</span> <span class="number">0</span>);
|
|
p<span class="operator">.</span><a href="qpoint.html#rx">rx</a>()<span class="operator">+</span><span class="operator">+</span>;</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>
|
|
</div>
|
|
<p><b>See also </b><a href="qpointf.html">QPointF</a> and <a href="qpolygon.html">QPolygon</a>.</p>
|
|
<!-- @@@QPoint -->
|
|
<div class="func">
|
|
<h2>Member Function Documentation</h2>
|
|
<!-- $$$QPoint[overload1]$$$QPoint -->
|
|
<h3 class="fn"><a name="QPoint"></a>QPoint::<span class="name">QPoint</span> ()</h3>
|
|
<p>Constructs a null point, i.e. with coordinates (0, 0)</p>
|
|
<p><b>See also </b><a href="qpoint.html#isNull">isNull</a>().</p>
|
|
<!-- @@@QPoint -->
|
|
<!-- $$$QPoint$$$QPointintint -->
|
|
<h3 class="fn"><a name="QPoint-2"></a>QPoint::<span class="name">QPoint</span> ( <span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i> )</h3>
|
|
<p>Constructs a point with the given coordinates (<i>x</i>, <i>y</i>).</p>
|
|
<p><b>See also </b><a href="qpoint.html#setX">setX</a>() and <a href="qpoint.html#setY">setY</a>().</p>
|
|
<!-- @@@QPoint -->
|
|
<!-- $$$isNull[overload1]$$$isNull -->
|
|
<h3 class="fn"><a name="isNull"></a><span class="type">bool</span> QPoint::<span class="name">isNull</span> () const</h3>
|
|
<p>Returns true if both the x and y coordinates are set to 0, otherwise returns false.</p>
|
|
<!-- @@@isNull -->
|
|
<!-- $$$manhattanLength[overload1]$$$manhattanLength -->
|
|
<h3 class="fn"><a name="manhattanLength"></a><span class="type">int</span> QPoint::<span class="name">manhattanLength</span> () const</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="cpp"> <span class="type"><a href="qpoint.html">QPoint</a></span> oldPosition;
|
|
|
|
MyWidget<span class="operator">::</span>mouseMoveEvent(<span class="type"><a href="qmouseevent.html">QMouseEvent</a></span> <span class="operator">*</span>event)
|
|
{
|
|
<span class="type"><a href="qpoint.html">QPoint</a></span> point <span class="operator">=</span> event<span class="operator">-</span><span class="operator">></span>pos() <span class="operator">-</span> oldPosition;
|
|
<span class="keyword">if</span> (point<span class="operator">.</span>manhattanLength() <span class="operator">></span> <span class="number">3</span>)
|
|
<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="cpp"> <span class="type">double</span> trueLength <span class="operator">=</span> sqrt(pow(x()<span class="operator">,</span> <span class="number">2</span>) <span class="operator">+</span> pow(y()<span class="operator">,</span> <span class="number">2</span>));</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>
|
|
<!-- @@@manhattanLength -->
|
|
<!-- $$$rx[overload1]$$$rx -->
|
|
<h3 class="fn"><a name="rx"></a><span class="type">int</span> & QPoint::<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="qpoint.html">QPoint</a></span> p(<span class="number">1</span><span class="operator">,</span> <span class="number">2</span>);
|
|
p<span class="operator">.</span>rx()<span class="operator">-</span><span class="operator">-</span>; <span class="comment">// p becomes (0, 2)</span></pre>
|
|
<p><b>See also </b><a href="qpoint.html#x">x</a>() and <a href="qpoint.html#setX">setX</a>().</p>
|
|
<!-- @@@rx -->
|
|
<!-- $$$ry[overload1]$$$ry -->
|
|
<h3 class="fn"><a name="ry"></a><span class="type">int</span> & QPoint::<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="qpoint.html">QPoint</a></span> p(<span class="number">1</span><span class="operator">,</span> <span class="number">2</span>);
|
|
p<span class="operator">.</span>ry()<span class="operator">+</span><span class="operator">+</span>; <span class="comment">// p becomes (1, 3)</span></pre>
|
|
<p><b>See also </b><a href="qpoint.html#y">y</a>() and <a href="qpoint.html#setY">setY</a>().</p>
|
|
<!-- @@@ry -->
|
|
<!-- $$$setX[overload1]$$$setXint -->
|
|
<h3 class="fn"><a name="setX"></a><span class="type">void</span> QPoint::<span class="name">setX</span> ( <span class="type">int</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="qpoint.html#x">x</a>() and <a href="qpoint.html#setY">setY</a>().</p>
|
|
<!-- @@@setX -->
|
|
<!-- $$$setY[overload1]$$$setYint -->
|
|
<h3 class="fn"><a name="setY"></a><span class="type">void</span> QPoint::<span class="name">setY</span> ( <span class="type">int</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="qpoint.html#y">y</a>() and <a href="qpoint.html#setX">setX</a>().</p>
|
|
<!-- @@@setY -->
|
|
<!-- $$$x[overload1]$$$x -->
|
|
<h3 class="fn"><a name="x"></a><span class="type">int</span> QPoint::<span class="name">x</span> () const</h3>
|
|
<p>Returns the x coordinate of this point.</p>
|
|
<p><b>See also </b><a href="qpoint.html#setX">setX</a>() and <a href="qpoint.html#rx">rx</a>().</p>
|
|
<!-- @@@x -->
|
|
<!-- $$$y[overload1]$$$y -->
|
|
<h3 class="fn"><a name="y"></a><span class="type">int</span> QPoint::<span class="name">y</span> () const</h3>
|
|
<p>Returns the y coordinate of this point.</p>
|
|
<p><b>See also </b><a href="qpoint.html#setY">setY</a>() and <a href="qpoint.html#ry">ry</a>().</p>
|
|
<!-- @@@y -->
|
|
<!-- $$$operator*=[overload1]$$$operator*=float -->
|
|
<h3 class="fn"><a name="operator-2a-eq"></a><span class="type">QPoint</span> & QPoint::<span class="name">operator*=</span> ( <span class="type">float</span> <i>factor</i> )</h3>
|
|
<p>Multiplies this point's coordinates by the given <i>factor</i>, and returns a reference to this point.</p>
|
|
<p>Note that the result is rounded to the nearest integer as points are held as integers. Use <a href="qpointf.html">QPointF</a> for floating point accuracy.</p>
|
|
<p>This function was introduced in Qt 4.8.</p>
|
|
<p><b>See also </b><a href="qpoint.html#operator-2f-eq">operator/=</a>().</p>
|
|
<!-- @@@operator*= -->
|
|
<!-- $$$operator*=$$$operator*=double -->
|
|
<h3 class="fn"><a name="operator-2a-eq-2"></a><span class="type">QPoint</span> & QPoint::<span class="name">operator*=</span> ( <span class="type">double</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="qpoint.html">QPoint</a></span> p(<span class="operator">-</span><span class="number">1</span><span class="operator">,</span> <span class="number">4</span>);
|
|
p <span class="operator">*</span><span class="operator">=</span> <span class="number">2.5</span>; <span class="comment">// p becomes (-3, 10)</span></pre>
|
|
<p>Note that the result is rounded to the nearest integer as points are held as integers. Use <a href="qpointf.html">QPointF</a> for floating point accuracy.</p>
|
|
<p>This function was introduced in Qt 4.8.</p>
|
|
<p><b>See also </b><a href="qpoint.html#operator-2f-eq">operator/=</a>().</p>
|
|
<!-- @@@operator*= -->
|
|
<!-- $$$operator*=$$$operator*=int -->
|
|
<h3 class="fn"><a name="operator-2a-eq-3"></a><span class="type">QPoint</span> & QPoint::<span class="name">operator*=</span> ( <span class="type">int</span> <i>factor</i> )</h3>
|
|
<p>Multiplies this point's coordinates by the given <i>factor</i>, and returns a reference to this point.</p>
|
|
<p>This function was introduced in Qt 4.8.</p>
|
|
<p><b>See also </b><a href="qpoint.html#operator-2f-eq">operator/=</a>().</p>
|
|
<!-- @@@operator*= -->
|
|
<!-- $$$operator+=[overload1]$$$operator+=constQPoint& -->
|
|
<h3 class="fn"><a name="operator-2b-eq"></a><span class="type">QPoint</span> & QPoint::<span class="name">operator+=</span> ( const <span class="type">QPoint</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="qpoint.html">QPoint</a></span> p( <span class="number">3</span><span class="operator">,</span> <span class="number">7</span>);
|
|
<span class="type"><a href="qpoint.html">QPoint</a></span> q(<span class="operator">-</span><span class="number">1</span><span class="operator">,</span> <span class="number">4</span>);
|
|
p <span class="operator">+</span><span class="operator">=</span> q; <span class="comment">// p becomes (2, 11)</span></pre>
|
|
<p><b>See also </b><a href="qpoint.html#operator--eq">operator-=</a>().</p>
|
|
<!-- @@@operator+= -->
|
|
<!-- $$$operator-=[overload1]$$$operator-=constQPoint& -->
|
|
<h3 class="fn"><a name="operator--eq"></a><span class="type">QPoint</span> & QPoint::<span class="name">operator-=</span> ( const <span class="type">QPoint</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="qpoint.html">QPoint</a></span> p( <span class="number">3</span><span class="operator">,</span> <span class="number">7</span>);
|
|
<span class="type"><a href="qpoint.html">QPoint</a></span> q(<span class="operator">-</span><span class="number">1</span><span class="operator">,</span> <span class="number">4</span>);
|
|
p <span class="operator">-</span><span class="operator">=</span> q; <span class="comment">// p becomes (4, 3)</span></pre>
|
|
<p><b>See also </b><a href="qpoint.html#operator-2b-eq">operator+=</a>().</p>
|
|
<!-- @@@operator-= -->
|
|
<!-- $$$operator/=[overload1]$$$operator/=qreal -->
|
|
<h3 class="fn"><a name="operator-2f-eq"></a><span class="type">QPoint</span> & QPoint::<span class="name">operator/=</span> ( <span class="type"><a href="qtglobal.html#qreal-typedef">qreal</a></span> <i>divisor</i> )</h3>
|
|
<p>This is an overloaded function.</p>
|
|
<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="qpoint.html">QPoint</a></span> p(<span class="operator">-</span><span class="number">3</span><span class="operator">,</span> <span class="number">10</span>);
|
|
p <span class="operator">/</span><span class="operator">=</span> <span class="number">2.5</span>; <span class="comment">// p becomes (-1, 4)</span></pre>
|
|
<p>Note that the result is rounded to the nearest integer as points are held as integers. Use <a href="qpointf.html">QPointF</a> for floating point accuracy.</p>
|
|
<p><b>See also </b><a href="qpoint.html#operator-2a-eq">operator*=</a>().</p>
|
|
<!-- @@@operator/= -->
|
|
</div>
|
|
<div class="relnonmem">
|
|
<h2>Related Non-Members</h2>
|
|
<!-- $$$operator!=$$$operator!=constQPoint&constQPoint& -->
|
|
<h3 class="fn"><a name="operator-not-eq-62"></a><span class="type">bool</span> <span class="name">operator!=</span> ( const <span class="type">QPoint</span> & <i>p1</i>, const <span class="type">QPoint</span> & <i>p2</i> )</h3>
|
|
<p>Returns true if <i>p1</i> and <i>p2</i> are not equal; otherwise returns false.</p>
|
|
<!-- @@@operator!= -->
|
|
<!-- $$$operator*$$$operator*constQPoint&float -->
|
|
<h3 class="fn"><a name="operator-2a-50"></a>const <span class="type">QPoint</span> <span class="name">operator*</span> ( const <span class="type">QPoint</span> & <i>point</i>, <span class="type">float</span> <i>factor</i> )</h3>
|
|
<p>Returns a copy of the given <i>point</i> multiplied by the given <i>factor</i>.</p>
|
|
<p>Note that the result is rounded to the nearest integer as points are held as integers. Use <a href="qpointf.html">QPointF</a> for floating point accuracy.</p>
|
|
<p>This function was introduced in Qt 4.8.</p>
|
|
<p><b>See also </b><a href="qpoint.html#operator-2a-eq">QPoint::operator*=</a>().</p>
|
|
<!-- @@@operator* -->
|
|
<!-- $$$operator*$$$operator*constQPoint&double -->
|
|
<h3 class="fn"><a name="operator-2a-51"></a>const <span class="type">QPoint</span> <span class="name">operator*</span> ( const <span class="type">QPoint</span> & <i>point</i>, <span class="type">double</span> <i>factor</i> )</h3>
|
|
<p>Returns a copy of the given <i>point</i> multiplied by the given <i>factor</i>.</p>
|
|
<p>Note that the result is rounded to the nearest integer as points are held as integers. Use <a href="qpointf.html">QPointF</a> for floating point accuracy.</p>
|
|
<p>This function was introduced in Qt 4.8.</p>
|
|
<p><b>See also </b><a href="qpoint.html#operator-2a-eq">QPoint::operator*=</a>().</p>
|
|
<!-- @@@operator* -->
|
|
<!-- $$$operator*$$$operator*constQPoint&int -->
|
|
<h3 class="fn"><a name="operator-2a-52"></a>const <span class="type">QPoint</span> <span class="name">operator*</span> ( const <span class="type">QPoint</span> & <i>point</i>, <span class="type">int</span> <i>factor</i> )</h3>
|
|
<p>Returns a copy of the given <i>point</i> multiplied by the given <i>factor</i>.</p>
|
|
<p>This function was introduced in Qt 4.8.</p>
|
|
<p><b>See also </b><a href="qpoint.html#operator-2a-eq">QPoint::operator*=</a>().</p>
|
|
<!-- @@@operator* -->
|
|
<!-- $$$operator*$$$operator*floatconstQPoint& -->
|
|
<h3 class="fn"><a name="operator-2a-54"></a>const <span class="type">QPoint</span> <span class="name">operator*</span> ( <span class="type">float</span> <i>factor</i>, const <span class="type">QPoint</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>
|
|
<p>This function was introduced in Qt 4.8.</p>
|
|
<!-- @@@operator* -->
|
|
<!-- $$$operator*$$$operator*doubleconstQPoint& -->
|
|
<h3 class="fn"><a name="operator-2a-55"></a>const <span class="type">QPoint</span> <span class="name">operator*</span> ( <span class="type">double</span> <i>factor</i>, const <span class="type">QPoint</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>
|
|
<p>This function was introduced in Qt 4.8.</p>
|
|
<!-- @@@operator* -->
|
|
<!-- $$$operator*$$$operator*intconstQPoint& -->
|
|
<h3 class="fn"><a name="operator-2a-56"></a>const <span class="type">QPoint</span> <span class="name">operator*</span> ( <span class="type">int</span> <i>factor</i>, const <span class="type">QPoint</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>
|
|
<p>This function was introduced in Qt 4.8.</p>
|
|
<!-- @@@operator* -->
|
|
<!-- $$$operator+$$$operator+constQPoint&constQPoint& -->
|
|
<h3 class="fn"><a name="operator-2b-38"></a>const <span class="type">QPoint</span> <span class="name">operator+</span> ( const <span class="type">QPoint</span> & <i>p1</i>, const <span class="type">QPoint</span> & <i>p2</i> )</h3>
|
|
<p>Returns a <a href="qpoint.html">QPoint</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="qpoint.html#operator-2b-eq">QPoint::operator+=</a>().</p>
|
|
<!-- @@@operator+ -->
|
|
<!-- $$$operator-$$$operator-constQPoint&constQPoint& -->
|
|
<h3 class="fn"><a name="operator--15"></a>const <span class="type">QPoint</span> <span class="name">operator-</span> ( const <span class="type">QPoint</span> & <i>p1</i>, const <span class="type">QPoint</span> & <i>p2</i> )</h3>
|
|
<p>Returns a <a href="qpoint.html">QPoint</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="qpoint.html#operator--eq">QPoint::operator-=</a>().</p>
|
|
<!-- @@@operator- -->
|
|
<!-- $$$operator-$$$operator-constQPoint& -->
|
|
<h3 class="fn"><a name="operator--18"></a>const <span class="type">QPoint</span> <span class="name">operator-</span> ( const <span class="type">QPoint</span> & <i>point</i> )</h3>
|
|
<p>This is an overloaded function.</p>
|
|
<p>Returns a <a href="qpoint.html">QPoint</a> object that is formed by changing the sign of both components of the given <i>point</i>.</p>
|
|
<p>Equivalent to <tt>QPoint(0,0) - point</tt>.</p>
|
|
<!-- @@@operator- -->
|
|
<!-- $$$operator/$$$operator/constQPoint&qreal -->
|
|
<h3 class="fn"><a name="operator-2f-9"></a>const <span class="type">QPoint</span> <span class="name">operator/</span> ( const <span class="type">QPoint</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="qpoint.html">QPoint</a> formed by dividing both components of the given <i>point</i> by the given <i>divisor</i>.</p>
|
|
<p>Note that the result is rounded to the nearest integer as points are held as integers. Use <a href="qpointf.html">QPointF</a> for floating point accuracy.</p>
|
|
<p><b>See also </b><a href="qpoint.html#operator-2f-eq">QPoint::operator/=</a>().</p>
|
|
<!-- @@@operator/ -->
|
|
<!-- $$$operator<<$$$operator<<QDataStream&constQPoint& -->
|
|
<h3 class="fn"><a name="operator-lt-lt-202"></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">QPoint</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==$$$operator==constQPoint&constQPoint& -->
|
|
<h3 class="fn"><a name="operator-eq-eq-90"></a><span class="type">bool</span> <span class="name">operator==</span> ( const <span class="type">QPoint</span> & <i>p1</i>, const <span class="type">QPoint</span> & <i>p2</i> )</h3>
|
|
<p>Returns true if <i>p1</i> and <i>p2</i> are equal; otherwise returns false.</p>
|
|
<!-- @@@operator== -->
|
|
<!-- $$$operator>>$$$operator>>QDataStream&QPoint& -->
|
|
<h3 class="fn"><a name="operator-gt-gt-111"></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">QPoint</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 class="ft">
|
|
<span></span>
|
|
</div>
|
|
</div>
|
|
<div class="footer">
|
|
<p>
|
|
<acronym title="Copyright">©</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>
|