I've looked around on this forum and the web in general and have not found a clear discussion of using smart pointers with Qt objects. I am surprised to see most Qt examples using standard pointers. Does Qt perform some garbage collection?

Example:
Qt Code:
  1. QWidget * foo;
  2. foo = new QWidget();
  3. foo = new QWidget();
To copy to clipboard, switch view to plain text mode 

Will the first object float around in memory or be cleaned up?

If it's a leak, should I instead use something like Boost's shared_ptr:

Qt Code:
  1. shared_ptr<QWidget> foo;
  2. foo = shared_ptr<QWidget>(new QWidget());
  3. foo = shared_ptr<QWidget>(new QWidget());
To copy to clipboard, switch view to plain text mode 

I apologize if this question is ignorant of the underlying Qt design and/or has been answered thoroughly elsewhere on the forum.