Restore C++11 compatibility of QSharedPointer code
Qt5 still needs to compile with C++11, so we cannot use std::exchange which is a C++14 feature. Use qExchange instead, which is a drop-in replacement.
Change-Id: I1b4f62f2b67f371cfa9c0e6641656d02f03a6520