This commit is contained in:
2022-08-16 07:00:30 +02:00
parent d2c3bff1c7
commit a5b400208c
7 changed files with 273 additions and 196 deletions

View File

@@ -19,29 +19,37 @@ import numpy as np
from PyQt5.QtGui import QPolygon,QPolygonF
from PyQt5.QtCore import QPointF,QLineF
def obj_info(obj):
print(f"obj_info:{obj}")
def obj_tree(obj,p=''):
obj_info(obj,p)
for o in obj.childItems():
obj_tree(o,p+'.')
def obj_info(obj,p=''):
print(f"{p}obj_info:{obj}")
try:
pos=obj.pos()
print(f"Pos:({pos.x():.6g},{pos.y():.6g})") # in coordinate value on the scene (no change by zooming)
print(f"{p}Pos:({pos.x():.6g},{pos.y():.6g})") # in coordinate value on the scene (no change by zooming)
except AttributeError:
pass
try:
for k, v in (('Viewport', obj.viewport()), ('Window', obj.window())):
print(
f"{k} (x,y)(w,h):({v.x():.6g},{v.y():.6g})({v.width():.6g},{v.height():.6g})") # in coordinate value on the scene (no change by zooming)
f"{p}{k} (x,y)(w,h):({v.x():.6g},{v.y():.6g})({v.width():.6g},{v.height():.6g})") # in coordinate value on the scene (no change by zooming)
except AttributeError:
pass
try:
scnPos=obj.scenePos()
print(f"scenePos:({scnPos.x():.6g},{scnPos.y():.6g})") # in pixel on the scene (changes by zooming)
print(f"{p}scenePos:({scnPos.x():.6g},{scnPos.y():.6g})") # in pixel on the scene (changes by zooming)
except AttributeError:
pass
try:
t=obj.transform()
print(f"QTransform:{t.m11():8.5g} {t.m12():8.5g} {t.m13():8.5g}")
print(f" {t.m21():8.5g} {t.m22():8.5g} {t.m23():8.5g}")
print(f" {t.m31():8.5g} {t.m32():8.5g} {t.m33():8.5g}")
if type(obj)==QtGui.QTransform:
t=obj
else:
t=obj.transform()
print(f"{p}QTransform:{t.m11():8.5g} {t.m12():8.5g} {t.m13():8.5g}")
print(f"{p} {t.m21():8.5g} {t.m22():8.5g} {t.m23():8.5g}")
print(f"{p} {t.m31():8.5g} {t.m32():8.5g} {t.m33():8.5g}")
except AttributeError:
pass