Qt-interest Archive, April 2008
Change QGraphicsItem size on child add/remove/move/resize.
Message 1 in thread
My question is:
--------------------------------------------
How to make
class MyItem : public QObject, public QGraphicsItem,
so that MyItem keep it's size equal to children sizes.
---------------------------------------------
I have implemented
AbstractElement : public QObject,public QGraphicsItem,
so that AbstractElement keep it's size equal to children sizes already.
But I don't use this:
QRectF boundingRect() const
{
return childrenBoundingRect();
}
because it's too cpu hungry.
Instead of that I recalculate and store rect every time
child added/removed/moved or resized and save it.
So it works good first one month of development but now I get bug that I can't
solve:
QGraphicsItem::childrenBoundingRect() crash sometimes,
due to one child object wasn't fully constructed or some other reasons.
If someone have same class or ideas - I really need them! Thank you!
--
[ signature omitted ]