I want to know if QHash, QList makes a copy of the items inserted into them or what ??
Suppose I have a function CreateList()

Qt Code:
  1. class MyNode
  2. {
  3. int id;
  4. QScene *scene; // pointer to a scene or any other class based on id.
  5. public :
  6. MyNode(QScene *s)
  7. { scene = s;
  8. id = 0; // or some unique value
  9. }
  10. };
  11. QList<MyNode> list;
  12. void CreateList()
  13. {
  14. MyNode node(this->pScene);
  15. list.append(node);
  16. }
To copy to clipboard, switch view to plain text mode 


Here I have added just one item, though multiple items may be insterted in the list. I want to know when CreateList function is exited, wll list still have valid copy of node ??

also what if i have pointers instead of objects..
like
Qt Code:
  1. QList<MyNode*> list;
  2. void CreateList()
  3. {
  4. MyNode *node = new MyNode(this->pScene); // node contains some
  5. list.append(node);
  6. }
To copy to clipboard, switch view to plain text mode 

in this case how do i delete the actual nodes created. Does list.clear() call the destructor too ?? if not what is the safe way of freeing the memory when a list of pointers is cleared ?

I think I know the answers, but still a little confused,so asking in the forum, (i know i sound a little stupid here )
Thx in advance