次のコードを使用して、新しい QML 画面を作成しています。
var newComp = Qt.createComponent(“test.qml”);
var newObject = newComp.createObject(parent, {“x”: 0, “y”: 0});
このコンポーネントをローダーに設定したいです。
私はそれを使用してそれをやろうとしましたLoader.sourceComponent = newObject;
動作しますが、次のエラーが発生します。
“Error: Cannot assign QObject* to QDeclarativeComponent*”
これに対する回避策はありますか。
ありがとう。