Add label location description param for graphics path anchor
parent
d21112dcd7
commit
ff6ac6ba4f
|
@ -158,16 +158,26 @@ def update_pp_nav(
|
||||||
label.update()
|
label.update()
|
||||||
|
|
||||||
|
|
||||||
def path_topright(
|
def gpath_pin(
|
||||||
|
|
||||||
gpath: QGraphicsPathItem,
|
gpath: QGraphicsPathItem,
|
||||||
label: Label, # noqa
|
label: Label, # noqa
|
||||||
|
|
||||||
|
location_description: str = 'right-of-path-centered',
|
||||||
|
use_right_of_pp_label: bool = False,
|
||||||
|
|
||||||
) -> QPointF:
|
) -> QPointF:
|
||||||
|
|
||||||
# get actual arrow graphics path
|
# get actual arrow graphics path
|
||||||
path_br = gpath.mapToScene(
|
path_br = gpath.mapToScene(gpath.path()).boundingRect()
|
||||||
gpath.path()
|
|
||||||
).boundingRect()
|
|
||||||
|
|
||||||
# vb.locate(arrow_path) #, children=True)
|
# vb.locate(arrow_path) #, children=True)
|
||||||
|
|
||||||
return path_br.topRight() - QPointF(0, label.h / 3)
|
if location_description == 'right-of-path-centered':
|
||||||
|
return path_br.topRight() - QPointF(0, label.h / 3)
|
||||||
|
|
||||||
|
elif location_description == 'below-path-left-aligned':
|
||||||
|
return path_br.bottomLeft() - QPointF(0, label.h / 6)
|
||||||
|
|
||||||
|
elif location_description == 'below-path-right-aligned':
|
||||||
|
return path_br.bottomRight() - QPointF(label.w, label.h / 6)
|
||||||
|
|
Loading…
Reference in New Issue