Hi, During the constructor phase of my QGraphicsItem derive class, I need to perform some QFont related information. The font information may be obtained via scene object but my study of the constructor stage is that it is not initialized yet.
The derived class is added to the scene via the addItem() call. Is there another way to access the scene in a QGraphicsItem constructor ? For now, I am passing the scene object explicitly class NodeItem(QtWidgets.QGraphicsItem): def __init__(self, name, attribues, scene): '''scene is only required because we need to query the font ''' super(NodeItem, self).__init__() Q : Does my need to use scene in the constructor indicates that my class was not designed properly? Q : Are there other ways to obtain the font information in the constructor other than ? font = scene.property('font') fm = QtGui.QFontMetrics(font) Cheers -- Nicholas Yue Graphics - Arnold, Alembic, RenderMan, OpenGL, HDF5 Custom Dev - C++ porting, OSX, Linux, Windows http://au.linkedin.com/in/nicholasyue https://vimeo.com/channels/naiadtools
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest