从QByteArray加载QQuickView

时间:2015-01-12 12:07:04

标签: c++ qt qml qtquick2 qt-quick

有没有办法用字符串数据加载QQuickView? 据我所知,只有void QQuickView::setSource(const QUrl & url)

我可以使用字符串数据加载QQmlComponent,但现在我该如何将此组件分配给QQuickView

1 个答案:

答案 0 :(得分:1)

创建QQuickView时,您可以传递QQmlComponent引擎:

QQmlComponent component(view->engine(), QUrl("path/to/file.qml"));