QSharedPointer gives nasty compile time warnings if the class whose smart pointer is being made is forward declared. QScopedPointer documentation has some documentation on how to avoid warnings with forward declaration. As has been pointed out in this bug, works for QSharedPointer too...
https://bugreports.qt-project.org/browse/QTBUG-7302

However compiler warnings persist for me... consider code...
Qt Code:
  1. class MyPrivateClass; // forward declare MyPrivateClass
  2.  
  3. class MyClass
  4. {
  5. private:
  6. QList<QScopedPointer<MyPrivateClass> > privatePtr; //QList QScopedPointer to forward declared class
  7.  
  8. public:
  9. MyClass(); // OK
  10. ~MyClass(); // Not a VIOLATION - Destructor must not be inline
  11.  
  12. private:
  13. Q_DISABLE_COPY(MyClass) // OK - copy constructor and assignment operators
  14. // are now disabled, so the compiler won't implicitely
  15. // generate them.
  16. };
To copy to clipboard, switch view to plain text mode 
Any way to avoid the warnings.. the qt version is 4.8.4... the bug is apparently fixed in 5.0 but can't shift.