Hi everyone

I have system that has classes derived from QGraphicsWidget. 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?

I think you want to inherit the constructors too.

I think you want to inherit the constructors too.

What do you really mean by that?

I really don't know for sure if that's what you want to do but if you're trying to build a derived object out of several classes you should initialize the inherited constructors too.

I really don't know for sure if that's what you want to do but if you're trying to build a derived object out of several classes you should initialize the inherited constructors too.

You may be right. I will give it a try!

I initialized derived constructors. No success. But I figured out that problem is related with QGraphicsLayoutItem base class.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.