1
<?xml version="1.0" encoding="iso-8859-1"?>
3
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/corelib/tools/qline.cpp -->
7
<title>Qt 4.0: QLine Class Reference</title>
8
<style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
9
a:link { color: #004faf; text-decoration: none }
10
a:visited { color: #672967; text-decoration: none }
11
td.postheader { font-family: sans-serif }
12
tr.address { font-family: sans-serif }
13
body { background: #ffffff; color: black; }</style>
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
19
<td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> · <a href="annotated.html"><font color="#004faf">Annotated</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td>
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QLine Class Reference</h1>
21
<p>The QLine class provides a two-dimensional vector that uses integer point accuracy for coordinates. <a href="#details">More...</a></p>
22
<pre>#include <QLine></pre><p>Part of the <a href="qtcore.html">QtCore</a> module.</p>
24
<li><a href="qline-members.html">List of all members, including inherited members</a></li>
26
<a name="public-functions"></a>
27
<h3>Public Functions</h3>
29
<li><div class="fn"/><b><a href="qline.html#QLine">QLine</a></b> ()</li>
30
<li><div class="fn"/><b><a href="qline.html#QLine-2">QLine</a></b> ( const QPoint & <i>pt1</i>, const QPoint & <i>pt2</i> )</li>
31
<li><div class="fn"/><b><a href="qline.html#QLine-3">QLine</a></b> ( int <i>x1</i>, int <i>y1</i>, int <i>x2</i>, int <i>y2</i> )</li>
32
<li><div class="fn"/>QPoint <b><a href="qline.html#p1">p1</a></b> () const</li>
33
<li><div class="fn"/>QPoint <b><a href="qline.html#p2">p2</a></b> () const</li>
34
<li><div class="fn"/>int <b><a href="qline.html#x1">x1</a></b> () const</li>
35
<li><div class="fn"/>int <b><a href="qline.html#x2">x2</a></b> () const</li>
36
<li><div class="fn"/>int <b><a href="qline.html#y1">y1</a></b> () const</li>
37
<li><div class="fn"/>int <b><a href="qline.html#y2">y2</a></b> () const</li>
38
<li><div class="fn"/>int <b><a href="qline.html#dx">dx</a></b> () const</li>
39
<li><div class="fn"/>int <b><a href="qline.html#dy">dy</a></b> () const</li>
40
<li><div class="fn"/>bool <b><a href="qline.html#isNull">isNull</a></b> () const</li>
41
<li><div class="fn"/>void <b><a href="qline.html#translate">translate</a></b> ( const QPoint & <i>point</i> )</li>
42
<li><div class="fn"/>void <b><a href="qline.html#translate-2">translate</a></b> ( int <i>dx</i>, int <i>dy</i> )</li>
43
<li><div class="fn"/>bool <b><a href="qline.html#operator-not-eq">operator!=</a></b> ( const QLine & <i>other</i> ) const</li>
44
<li><div class="fn"/>bool <b><a href="qline.html#operator-eq-eq">operator==</a></b> ( const QLine & <i>other</i> ) const</li>
46
<a name="related-non-members"></a>
47
<h3>Related Non-Members</h3>
49
<li><div class="fn"/>QDataStream & <b><a href="qline.html#operator-lt-lt-35">operator<<</a></b> ( QDataStream & <i>stream</i>, const QLine & <i>line</i> )</li>
50
<li><div class="fn"/>QDataStream & <b><a href="qline.html#operator-gt-gt-22">operator>></a></b> ( QDataStream & <i>stream</i>, QLine & <i>line</i> )</li>
52
<a name="details"></a>
54
<h2>Detailed Description</h2>
55
<p>The QLine class provides a two-dimensional vector that uses integer point accuracy for coordinates.</p>
56
<p>A QLine describes a finite length line (or line segment) on a two-dimensional surface. The start and end points of the line are specified using integer point coordinates.</p>
57
<p>Use <a href="qline.html#isNull">isNull</a>() to determine whether the QLine represents a valid line or a null line.</p>
58
<p>The positions of the line's end points can be found with the <a href="qline.html#p1">p1</a>(), <a href="qline.html#x1">x1</a>(), <a href="qline.html#y1">y1</a>(), <a href="qline.html#p2">p2</a>(), <a href="qline.html#x2">x2</a>(), and <a href="qline.html#y2">y2</a>() functions. The horizontal and vertical components of the line are returned by the <a href="qline.html#dx">dx</a>() and <a href="qline.html#dy">dy</a>() functions.</p>
59
<p>The line can be translated along the length of another line with the <a href="qline.html#translate">translate</a>() function.</p>
60
<p>See also <a href="qpoint.html">QPoint</a>, <a href="qsize.html">QSize</a>, <a href="qrect.html">QRect</a>, and <a href="qlinef.html">QLineF</a>.</p>
62
<h2>Member Function Documentation</h2>
63
<h3 class="fn"><a name="QLine"></a>QLine::QLine ()</h3>
64
<p>Constructs a null line.</p>
65
<h3 class="fn"><a name="QLine-2"></a>QLine::QLine ( const <a href="qpoint.html">QPoint</a> & <i>pt1</i>, const <a href="qpoint.html">QPoint</a> & <i>pt2</i> )</h3>
66
<p>Constructs a line object that represents the line between <i>pt1</i> and <i>pt2</i>.</p>
67
<h3 class="fn"><a name="QLine-3"></a>QLine::QLine ( int <i>x1</i>, int <i>y1</i>, int <i>x2</i>, int <i>y2</i> )</h3>
68
<p>Constructs a line object that represents the line between (<i>x1</i>, <i>y1</i>) and (<i>x2</i>, <i>y2</i>).</p>
69
<h3 class="fn"><a name="p1"></a><a href="qpoint.html">QPoint</a> QLine::p1 () const</h3>
70
<p>Returns the line's start point.</p>
71
<p>See also <a href="qline.html#x1">x1</a>(), <a href="qline.html#y1">y1</a>(), and <a href="qline.html#p2">p2</a>().</p>
72
<h3 class="fn"><a name="p2"></a><a href="qpoint.html">QPoint</a> QLine::p2 () const</h3>
73
<p>Returns the line's end point.</p>
74
<p>See also <a href="qline.html#x2">x2</a>(), <a href="qline.html#y2">y2</a>(), and <a href="qline.html#p1">p1</a>().</p>
75
<h3 class="fn"><a name="x1"></a>int QLine::x1 () const</h3>
76
<p>Returns the x-coordinate of the line's start point.</p>
77
<p>See also <a href="qline.html#y1">y1</a>(), <a href="qline.html#x2">x2</a>(), and <a href="qline.html#p1">p1</a>().</p>
78
<h3 class="fn"><a name="x2"></a>int QLine::x2 () const</h3>
79
<p>Returns the x-coordinate of the line's end point.</p>
80
<p>See also <a href="qline.html#y2">y2</a>(), <a href="qline.html#x1">x1</a>(), and <a href="qline.html#p2">p2</a>().</p>
81
<h3 class="fn"><a name="y1"></a>int QLine::y1 () const</h3>
82
<p>Returns the y-coordinate of the line's start point.</p>
83
<p>See also <a href="qline.html#x1">x1</a>(), <a href="qline.html#y2">y2</a>(), and <a href="qline.html#p1">p1</a>().</p>
84
<h3 class="fn"><a name="y2"></a>int QLine::y2 () const</h3>
85
<p>Returns the y-coordinate of the line's end point.</p>
86
<p>See also <a href="qline.html#x2">x2</a>(), <a href="qline.html#y1">y1</a>(), and <a href="qline.html#p2">p2</a>().</p>
87
<h3 class="fn"><a name="dx"></a>int QLine::dx () const</h3>
88
<p>Returns the horizontal component of the line's vector.</p>
89
<p>See also <a href="qline.html#dy">dy</a>().</p>
90
<h3 class="fn"><a name="dy"></a>int QLine::dy () const</h3>
91
<p>Returns the vertical component of the line's vector.</p>
92
<p>See also <a href="qline.html#dx">dx</a>().</p>
93
<h3 class="fn"><a name="isNull"></a>bool QLine::isNull () const</h3>
94
<p>Returns true if the line is not set up with valid start and end point; otherwise returns false.</p>
95
<h3 class="fn"><a name="translate"></a>void QLine::translate ( const <a href="qpoint.html">QPoint</a> & <i>point</i> )</h3>
96
<p>Translates this line with the <i>point</i> given.</p>
97
<h3 class="fn"><a name="translate-2"></a>void QLine::translate ( int <i>dx</i>, int <i>dy</i> )</h3>
98
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
99
<p>Translates this line the distance <i>dx</i> and <i>dy</i>.</p>
100
<h3 class="fn"><a name="operator-not-eq"></a>bool QLine::operator!= ( const QLine & <i>other</i> ) const</h3>
101
<p>Returns true if <i>other</i> is not the same as this line.</p>
102
<p>A line is different from another line if any of their points are different or their order is different.</p>
103
<h3 class="fn"><a name="operator-eq-eq"></a>bool QLine::operator== ( const QLine & <i>other</i> ) const</h3>
104
<p>Returns true if <i>other</i> is the same line as this line.</p>
105
<p>A line is identical to another line if the points are the same and their order is the same.</p>
107
<h2>Related Non-Members</h2>
108
<h3 class="fn"><a name="operator-lt-lt-35"></a><a href="qdatastream.html">QDataStream</a> & operator<< ( <a href="qdatastream.html">QDataStream</a> & <i>stream</i>, const QLine & <i>line</i> )</h3>
109
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
110
<p>Writes the <i>line</i> to the <i>stream</i> and returns a reference to the stream.</p>
111
<p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.</p>
112
<h3 class="fn"><a name="operator-gt-gt-22"></a><a href="qdatastream.html">QDataStream</a> & operator>> ( <a href="qdatastream.html">QDataStream</a> & <i>stream</i>, QLine & <i>line</i> )</h3>
113
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
114
<p>Reads a <a href="qline.html">QLine</a> from the <i>stream</i> into the <i>line</i> and returns a reference to the stream.</p>
115
<p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.</p>
116
<p /><address><hr /><div align="center">
117
<table width="100%" cellspacing="0" border="0"><tr class="address">
118
<td width="30%">Copyright © 2005 <a href="trolltech.html">Trolltech</a></td>
119
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
120
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
121
</tr></table></div></address></body>