33 if (m_owner != NULL) {
34 m_owner->removeFromOwned(
this);
38 foreach (
Owned o, m_owned) {
50 if ((m_owner != NULL) && (m_owner != owner)) {
51 m_owner->removeFromOwned(
this);
57 if (m_owner != NULL) {
58 m_owner->addToOwned(
this, destroy);
62 void Ownable::addToOwned(
Ownable *obj,
bool destroy)
64 m_owned.append(Owned(obj, destroy));
67 void Ownable::removeFromOwned(Ownable *obj)
69 m_owned.removeAll(Owned(obj));
The structure with information about the owned object.
The base for all class that can have (and can be) an owner.
bool destroy
If true the object is automatically destroyed by the owner destructor.
void setOwner(Ownable *owner, bool destroy=true)
Sets the owner of this object.
virtual ~Ownable()
Destructor.
Ownable * object
The owned object.
Ownable * owner() const
Returns the owner of this object.