Use QScopedPointer for cleaner code