954,483 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Subclassing QGraphicsItemGroup

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?

onurozcelik
Newbie Poster
5 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
 

I think you want to inherit the constructors too.

caut_baia
Posting Whiz
387 posts since Apr 2010
Reputation Points: 25
Solved Threads: 49
 
I think you want to inherit the constructors too.

What do you really mean by that?

onurozcelik
Newbie Poster
5 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
 

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.

caut_baia
Posting Whiz
387 posts since Apr 2010
Reputation Points: 25
Solved Threads: 49
 
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!

onurozcelik
Newbie Poster
5 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
 

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

onurozcelik
Newbie Poster
5 posts since Apr 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: