QmlObject: Use std::shared_ptr to properly track the lifetime of QQmlEngine
The engine passed to QmlObject is potentially shared, either because it comes from QmlObjectSharedEngine or because the caller is already using it. Since raw pointers do not provide any information about that, deprecate the raw pointer constructors and replace them with a constructor taking a std::shared_ptr.
This allows QmlObject to properly track if its the first user of the QQmlEngine and if so, call KDeclarative::setupEngine on it. It also allows it to know if it is the last user of the engine, and in that case properly cleanup the QNAM factory, without affecting the shared engine case.
The second commit drops the KDeclarative instance from QmlObject, since the only remaining non-deprecated methods are static so we no longer need an instance to access them.