开发者

Subclassing QGraphicsItemGroup

开发者 https://www.devze.com 2022-12-28 18:09 出处:网络
I have system that has classes derived from Q开发者_StackOverflowGraphicsWidget. I manage derived class objects in layouts on QGraphicsScene. Now I need a compound item that contain two or more QGraph

I have system that has classes derived from Q开发者_StackOverflowGraphicsWidget. I manage derived class objects in layouts on QGraphicsScene. Now I need a compound item that contain two or more QGraphicsWidget in it and also I need to put that item inside my layout. So I choose QGraphicsItemGroup and write I class like this.

class CompositeItem : public QGraphicsItemGroup,public QGraphicsLayoutItem
{   
   ...  
};

I only implemented sizeHint function again. When add CompositeItem instance to layout it does not shown. What may cause this? Where I made wrong?


Call show() on either the QGraphicsItemGroup or QGraphicsWidgets after adding to the layout.


Add setGraphicsItem( this ) to your constructor.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号