I mean that you can have a public member in your child
public:
MyParentClass *myparent; //In this case I'm asuming MyParentClass is a subclass of any QGraphicsItem
public:
MyParentClass *myparent; //In this case I'm asuming MyParentClass is a subclass of any QGraphicsItem
To copy to clipboard, switch view to plain text mode
and in the constructor of the child you have:
myparent = 0;
myparent = 0;
To copy to clipboard, switch view to plain text mode
then you can check when parenting the child:
if (!myparent) //Only if my parent is 0 which mean that it does not have a parent
{
myparent = mynewparent;
}
if (!myparent) //Only if my parent is 0 which mean that it does not have a parent
{
myparent = mynewparent;
}
To copy to clipboard, switch view to plain text mode
Bookmarks