LineF
Qt Base Class: QLineF
Signature: QLineF(self) -> None
QLineF(self, QLineF: Union[PySide6.QtCore.QLineF, PySide6.QtCore.QLine]) -> None
QLineF(self, line: PySide6.QtCore.QLine) -> None
QLineF(self, pt1: Union[PySide6.QtCore.QPointF, PySide6.QtCore.QPoint], pt2: Union[PySide6.QtCore.QPointF, PySide6.QtCore.QPoint]) -> None
QLineF(self, x1: float, y1: float, x2: float, y2: float) -> None
Base classes
Name |
Children |
Inherits |
QLineF PySide6.QtCore QLineF(self) -> None |
|
|
⋔ Inheritance diagram
graph TD
1473299797456["core.LineF"]
1473243588048["QtCore.QLineF"]
1473291690208["Shiboken.Object"]
140713234304496["builtins.object"]
1473243588048 --> 1473299797456
1473291690208 --> 1473243588048
140713234304496 --> 1473291690208
🛈 DocStrings
Bases: QLineF
Two-dimensional vector using floating point precision.
Source code in prettyqt\core\linef.py
| class LineF(core.QLineF):
"""Two-dimensional vector using floating point precision."""
def __repr__(self):
return get_repr(self, self.get_p1(), self.get_p2())
@property
def _x1(self) -> float:
return self.get_x1()
@property
def _y1(self) -> float:
return self.y1()
@property
def _x2(self) -> float:
return self.x2()
@property
def _y2(self) -> float:
return self.y2()
__match_args__ = ("_x1", "_y1", "_x2", "_y2")
def __reduce__(self):
return type(self), (self.get_p1(), self.get_p1())
def __reversed__(self):
return LineF(self.get_p2(), self.get_p1())
def __abs__(self) -> float:
return self.length()
def __iter__(self) -> Iterator[core.PointF]:
yield self.get_p1()
yield self.get_p2()
def __getitem__(self, index: Literal[0, 1]) -> core.PointF:
match index:
case 0:
return self.get_p1()
case 1:
return self.get_p2()
case _:
raise KeyError(index)
def __setitem__(self, index: Literal[0, 1], value: datatypes.PointFType):
match index:
case 0:
self.set_p1(value)
case 1:
self.set_p2(value)
case _:
raise KeyError(index)
def set_p1(self, point: datatypes.PointFType):
self.setP1(datatypes.to_pointf(point))
def get_p1(self) -> core.PointF:
return core.PointF(self.p1())
def set_p2(self, point: datatypes.PointFType):
self.setP2(datatypes.to_pointf(point))
def get_p2(self) -> core.PointF:
return core.PointF(self.p2())
def get_center(self) -> core.PointF:
return core.PointF(self.center())
def get_normal_vector(self) -> Self:
return type(self)(self.normalVector())
def get_unit_vector(self) -> Self:
return type(self)(self.unitVector())
def to_line(self) -> core.Line:
return core.Line(self.toLine())
|