1
我正在使用以下代碼創建新的QML屏幕。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*」
有沒有什麼解決方法。
謝謝。