Ported from QQuickView to QQmlComponent to avoid Qt bug

https://bugreports.qt-project.org/browse/QTBUG-35690