QGraphicsLineItem¶
The QGraphicsLineItem
class provides a line item that you can add to a QGraphicsScene
. More…
Synopsis¶
Functions¶
Detailed Description¶
To set the item’s line, pass a QLineF
to QGraphicsLineItem
‘s constructor, or call the setLine()
function. The line()
function returns the current line. By default the line is black with a width of 0, but you can change this by calling setPen()
.
QGraphicsLineItem
uses the line and the pen width to provide a reasonable implementation of boundingRect()
, shape()
, and contains()
. The paint()
function draws the line using the item’s associated pen.
- class PySide6.QtWidgets.QGraphicsLineItem([parent=None])¶
PySide6.QtWidgets.QGraphicsLineItem(line[, parent=None])
PySide6.QtWidgets.QGraphicsLineItem(x1, y1, x2, y2[, parent=None])
- Parameters
x2 – float
y2 – float
line –
PySide6.QtCore.QLineF
y1 – float
parent –
PySide6.QtWidgets.QGraphicsItem
x1 – float
Constructs a QGraphicsLineItem
. parent
is passed to QGraphicsItem
‘s constructor.
See also
Constructs a QGraphicsLineItem
, using line
as the default line. parent
is passed to QGraphicsItem
‘s constructor.
See also
Constructs a QGraphicsLineItem
, using the line between (x1
, y1
) and (x2
, y2
) as the default line. parent
is passed to QGraphicsItem
‘s constructor.
See also
- PySide6.QtWidgets.QGraphicsLineItem.line()¶
- Return type
Returns the item’s line, or a null line if no line has been set.
See also
- PySide6.QtWidgets.QGraphicsLineItem.pen()¶
- Return type
Returns the item’s pen, or a black solid 0-width pen if no pen has been set.
See also
- PySide6.QtWidgets.QGraphicsLineItem.setLine(line)¶
- Parameters
line –
PySide6.QtCore.QLineF
Sets the item’s line to be the given line
.
See also
- PySide6.QtWidgets.QGraphicsLineItem.setLine(x1, y1, x2, y2)
- Parameters
x1 – float
y1 – float
x2 – float
y2 – float
This is an overloaded function.
Sets the item’s line to be the line between (x1
, y1
) and (x2
, y2
).
This is the same as calling setLine(QLineF(x1, y1, x2, y2))
.
- PySide6.QtWidgets.QGraphicsLineItem.setPen(pen)¶
- Parameters
pen –
PySide6.QtGui.QPen
Sets the item’s pen to pen
. If no pen is set, the line will be painted using a black solid 0-width pen.
See also
© 2022 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.