[Interest] QGraphicsItem constructor access to scene
yue.nicholas at gmail.com
Tue Jun 9 06:07:14 CEST 2020
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
def __init__(self, name, attribues, scene):
'''scene is only required because we need to query the font
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)
Graphics - Arnold, Alembic, RenderMan, OpenGL, HDF5
Custom Dev - C++ porting, OSX, Linux, Windows
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Interest