Add a scene bounding rect getter to our label
parent
5144492534
commit
d283872eb6
|
@ -135,6 +135,12 @@ class Label:
|
||||||
def w(self) -> float:
|
def w(self) -> float:
|
||||||
return self.txt.boundingRect().width()
|
return self.txt.boundingRect().width()
|
||||||
|
|
||||||
|
def scene_br(self) -> QRectF:
|
||||||
|
txt = self.txt
|
||||||
|
return txt.mapToScene(
|
||||||
|
txt.boundingRect()
|
||||||
|
).boundingRect()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def h(self) -> float:
|
def h(self) -> float:
|
||||||
return self.txt.boundingRect().height()
|
return self.txt.boundingRect().height()
|
||||||
|
|
|
@ -314,9 +314,11 @@ class LevelLine(pg.InfiniteLine):
|
||||||
|
|
||||||
def paint(
|
def paint(
|
||||||
self,
|
self,
|
||||||
|
|
||||||
p: QtGui.QPainter,
|
p: QtGui.QPainter,
|
||||||
opt: QtWidgets.QStyleOptionGraphicsItem,
|
opt: QtWidgets.QStyleOptionGraphicsItem,
|
||||||
w: QtWidgets.QWidget
|
w: QtWidgets.QWidget
|
||||||
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Core paint which we override (yet again)
|
"""Core paint which we override (yet again)
|
||||||
from pg..
|
from pg..
|
||||||
|
@ -348,6 +350,8 @@ class LevelLine(pg.InfiniteLine):
|
||||||
# order lines.. not sure wtf is up with that.
|
# order lines.. not sure wtf is up with that.
|
||||||
# for now we're just using it on the position line.
|
# for now we're just using it on the position line.
|
||||||
elif self._marker:
|
elif self._marker:
|
||||||
|
# print('we have a marker?')
|
||||||
|
# self._chart.view.locate(self._marker)
|
||||||
|
|
||||||
# TODO: make this label update part of a scene-aware-marker
|
# TODO: make this label update part of a scene-aware-marker
|
||||||
# composed annotation
|
# composed annotation
|
||||||
|
|
Loading…
Reference in New Issue