Fix building when using Qt in a namespace

Wrap forward class declarations inside of QT_BEGIN_NAMESPACE and
QT_END_NAMESPACE macros.