QLine¶
Synopsis¶
Functions¶
def
__eq__
(d)def
__mul__
(, m)def
__mul__
(, m)def
__ne__
(d)def
__reduce__
()def
__repr__
()def
center
()def
dx
()def
dy
()def
isNull
()def
p1
()def
p2
()def
setLine
(x1, y1, x2, y2)def
setP1
(p1)def
setP2
(p2)def
setPoints
(p1, p2)def
toTuple
()def
translate
(dx, dy)def
translate
(p)def
translated
(dx, dy)def
translated
(p)def
x1
()def
x2
()def
y1
()def
y2
()
Detailed Description¶
A
QLine
describes a finite length line (or a line segment) on a two-dimensional surface. The start and end points of the line are specified using integer point accuracy for coordinates. Use theQLineF
constructor to retrieve a floating point copy.
The positions of the line’s start and end points can be retrieved using the
p1()
,x1()
,y1()
,p2()
,x2()
, andy2()
functions. Thedx()
anddy()
functions return the horizontal and vertical components of the line. UseisNull()
to determine whether theQLine
represents a valid line or a null line.Finally, the line can be translated a given offset using the
translate()
function.
-
class
QLine
¶ Constructs a null line.
Constructs a line object that represents the line between
p1
andp2
.Constructs a line object that represents the line between (
x1
,y1
) and (x2
,y2
).
-
PySide2.QtCore.QLine.
__reduce__
()¶ - Return type
PyObject
-
PySide2.QtCore.QLine.
__repr__
()¶ - Return type
PyObject
-
PySide2.QtCore.QLine.
center
()¶ - Return type
Returns the center point of this line. This is equivalent to (
p1()
+p2()
) / 2, except it will never overflow.
-
PySide2.QtCore.QLine.
dx
()¶ - Return type
int
Returns the horizontal component of the line’s vector.
See also
-
PySide2.QtCore.QLine.
dy
()¶ - Return type
int
Returns the vertical component of the line’s vector.
See also
-
PySide2.QtCore.QLine.
isNull
()¶ - Return type
bool
Returns
true
if the line is not set up with valid start and end point; otherwise returnsfalse
.
-
PySide2.QtCore.QLine.
__ne__
(d)¶ - Parameters
d –
QLine
- Return type
bool
Returns
true
if the givenline
is not the same as this line.A line is different from another line if any of their start or end points differ, or the internal order of the points is different.
-
PySide2.QtCore.QLine.
__mul__
(m) - Parameters
m –
QTransform
- Return type
-
PySide2.QtCore.QLine.
__eq__
(d)¶ - Parameters
d –
QLine
- Return type
bool
Returns
true
if the givenline
is the same as this line.A line is identical to another line if the start and end points are identical, and the internal order of the points is the same.
-
PySide2.QtCore.QLine.
setLine
(x1, y1, x2, y2)¶ - Parameters
x1 –
int
y1 –
int
x2 –
int
y2 –
int
Sets this line to the start in
x1
,y1
and end inx2
,y2
.
-
PySide2.QtCore.QLine.
setPoints
(p1, p2)¶ -
Sets the start point of this line to
p1
and the end point of this line top2
.
-
PySide2.QtCore.QLine.
toTuple
()¶ - Return type
PyObject
-
PySide2.QtCore.QLine.
translate
(dx, dy) - Parameters
dx –
int
dy –
int
This is an overloaded function.
Translates this line the distance specified by
dx
anddy
.
-
PySide2.QtCore.QLine.
translated
(p)¶ -
Returns this line translated by the given
offset
.
-
PySide2.QtCore.QLine.
translated
(dx, dy) - Parameters
dx –
int
dy –
int
- Return type
This is an overloaded function.
Returns this line translated the distance specified by
dx
anddy
.
-
PySide2.QtCore.QLine.
x1
()¶ - Return type
int
Returns the x-coordinate of the line’s start point.
See also
-
PySide2.QtCore.QLine.
x2
()¶ - Return type
int
Returns the x-coordinate of the line’s end point.
See also
-
PySide2.QtCore.QLine.
y1
()¶ - Return type
int
Returns the y-coordinate of the line’s start point.
See also
© 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. 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.