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
()
A
QLinedescribes 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 theQLineFconstructor 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(),和y2()functions. Thedx()anddy()functions return the horizontal and vertical components of the line. UseisNull()to determine whether theQLinerepresents a valid line or a null line.Finally, the line can be translated a given offset using the
translate()函数。
QLine
¶
Constructs a null line.
Constructs a line object that represents the line between
p1
and
p2
.
Constructs a line object that represents the line between (
x1
,
y1
) 和 (
x2
,
y2
).
PySide2.QtCore.QLine.
__reduce__
(
)
¶
PyObject
PySide2.QtCore.QLine.
__repr__
(
)
¶
PyObject
PySide2.QtCore.QLine.
center
(
)
¶
Returns the center point of this line. This is equivalent to (
p1()
+
p2()
) / 2, except it will never overflow.
PySide2.QtCore.QLine.
dx
(
)
¶
int
Returns the horizontal component of the line’s vector.
另请参阅
PySide2.QtCore.QLine.
dy
(
)
¶
int
Returns the vertical component of the line’s vector.
另请参阅
PySide2.QtCore.QLine.
isNull
(
)
¶
bool
返回
true
if the line is not set up with valid start and end point; otherwise returns
false
.
PySide2.QtCore.QLine.
__ne__
(
d
)
¶
d
–
QLine
bool
返回
true
若给定
line
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.
__eq__
(
d
)
¶
d
–
QLine
bool
返回
true
若给定
line
如同
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
)
¶
x1
–
int
y1
–
int
x2
–
int
y2
–
int
Sets this line to the start in
x1
,
y1
and end in
x2
,
y2
.
PySide2.QtCore.QLine.
setPoints
(
p1
,
p2
)
¶
Sets the start point of this line to
p1
and the end point of this line to
p2
.
PySide2.QtCore.QLine.
toTuple
(
)
¶
PyObject
PySide2.QtCore.QLine.
translate
(
dx
,
dy
)
¶
dx
–
int
dy
–
int
这是重载函数。
Translates this line the distance specified by
dx
and
dy
.
PySide2.QtCore.QLine.
translated
(
p
)
¶
Returns this line translated by the given
offset
.
PySide2.QtCore.QLine.
translated
(
dx
,
dy
)
¶
dx
–
int
dy
–
int
这是重载函数。
Returns this line translated the distance specified by
dx
and
dy
.
PySide2.QtCore.QLine.
x1
(
)
¶
int
Returns the x-coordinate of the line’s start point.
另请参阅
PySide2.QtCore.QLine.
y1
(
)
¶
int
Returns the y-coordinate of the line’s start point.
另请参阅