Implement the serialization in Qt

... and couple it directly to the creation and deletion of the engine.