Table Of Contents

Previous topic

QLineF

Next topic

QPointF

QLine

Inheritance diagram of QLine

Synopsis

Functions

Detailed Description

The PySide.QtCore.QLine class provides a two-dimensional vector using integer precision.

A PySide.QtCore.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 the PySide.QtCore.QLineF constructor to retrieve a floating point copy.

../../_images/qline-point.png ../../_images/qline-coordinates.png

The positions of the line’s start and end points can be retrieved using the PySide.QtCore.QLine.p1() , PySide.QtCore.QLine.x1() , PySide.QtCore.QLine.y1() , PySide.QtCore.QLine.p2() , PySide.QtCore.QLine.x2() , and PySide.QtCore.QLine.y2() functions. The PySide.QtCore.QLine.dx() and PySide.QtCore.QLine.dy() functions return the horizontal and vertical components of the line. Use PySide.QtCore.QLine.isNull() to determine whether the PySide.QtCore.QLine represents a valid line or a null line.

Finally, the line can be translated a given offset using the PySide.QtCore.QLine.translate() function.

class PySide.QtCore.QLine
class PySide.QtCore.QLine(QLine)
class PySide.QtCore.QLine(pt1, pt2)
class PySide.QtCore.QLine(x1, y1, x2, y2)
Parameters:

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 ) and (x2 , y2 ).

PySide.QtCore.QLine.__reduce__()
Return type:PyObject
PySide.QtCore.QLine.__repr__()
Return type:PyObject
PySide.QtCore.QLine.dx()
Return type:PySide.QtCore.int

Returns the horizontal component of the line’s vector.

PySide.QtCore.QLine.dy()
Return type:PySide.QtCore.int

Returns the vertical component of the line’s vector.

PySide.QtCore.QLine.isNull()
Return type:PySide.QtCore.bool

Returns true if the line is not set up with valid start and end point; otherwise returns false.

PySide.QtCore.QLine.__ne__(d)
Parameters:dPySide.QtCore.QLine
Return type:PySide.QtCore.bool

Returns true if the given 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.

PySide.QtCore.QLine.__mul__(m)
Parameters:mPySide.QtGui.QTransform
Return type:PySide.QtCore.QLine
PySide.QtCore.QLine.__mul__(m)
Parameters:mPySide.QtGui.QMatrix
Return type:PySide.QtCore.QLine
PySide.QtCore.QLine.__eq__(d)
Parameters:dPySide.QtCore.QLine
Return type:PySide.QtCore.bool

Returns true if the given line 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.

PySide.QtCore.QLine.p1()
Return type:PySide.QtCore.QPoint

Returns the line’s start point.

PySide.QtCore.QLine.p2()
Return type:PySide.QtCore.QPoint

Returns the line’s end point.

PySide.QtCore.QLine.setLine(x1, y1, x2, y2)
Parameters:
  • x1PySide.QtCore.int
  • y1PySide.QtCore.int
  • x2PySide.QtCore.int
  • y2PySide.QtCore.int

Sets this line to the start in x1 , y1 and end in x2 , y2 .

PySide.QtCore.QLine.setP1(p1)
Parameters:p1PySide.QtCore.QPoint

Sets the starting point of this line to p1 .

PySide.QtCore.QLine.setP2(p2)
Parameters:p2PySide.QtCore.QPoint

Sets the end point of this line to p2 .

PySide.QtCore.QLine.setPoints(p1, p2)
Parameters:

Sets the start point of this line to p1 and the end point of this line to p2 .

PySide.QtCore.QLine.toTuple()
Return type:PyObject
PySide.QtCore.QLine.translate(dx, dy)
Parameters:
  • dxPySide.QtCore.int
  • dyPySide.QtCore.int

This is an overloaded function.

Translates this line the distance specified by dx and dy .

PySide.QtCore.QLine.translate(p)
Parameters:pPySide.QtCore.QPoint

Translates this line by the given offset .

PySide.QtCore.QLine.translated(p)
Parameters:pPySide.QtCore.QPoint
Return type:PySide.QtCore.QLine

Returns this line translated by the given offset .

PySide.QtCore.QLine.translated(dx, dy)
Parameters:
  • dxPySide.QtCore.int
  • dyPySide.QtCore.int
Return type:

PySide.QtCore.QLine

This is an overloaded function.

Returns this line translated the distance specified by dx and dy .

PySide.QtCore.QLine.x1()
Return type:PySide.QtCore.int

Returns the x-coordinate of the line’s start point.

PySide.QtCore.QLine.x2()
Return type:PySide.QtCore.int

Returns the x-coordinate of the line’s end point.

PySide.QtCore.QLine.y1()
Return type:PySide.QtCore.int

Returns the y-coordinate of the line’s start point.

PySide.QtCore.QLine.y2()
Return type:PySide.QtCore.int

Returns the y-coordinate of the line’s end point.