qml-javascript でオブジェクトを動的に作成しようとしています。オブジェクトを作成する関数は次のとおりです。
function createSpriteObjects(xPos,yPos,cnt,imgsrc,jsonObject) {
var title;
title = jsonObject.matches[cnt].recipeName;
var component = Qt.createComponent("FlickItem.qml");
component.createObject(wall.contentItem, {"color":"white", "x":xPos,"y":yPos,"src":imgsrc,"opacity":1,"title":title});
}
受信ファイル (FlickItem.qml) にはプロパティ文字列 title があり、後で Text アイテムのテキスト フィールドに割り当てられます。
import QtQuick 2.0
Rectangle {
id: name
opacity: 0
property string title: ""
width:100
height:100
color:"white"
property string src: ""
Image {
id:recipeimages
source: src
width:240
height:160
}
Text {
id: title
anchors.bottom: recipeimages.bottom
anchors.horizontalCenter: recipeimages.horizontalCenter
anchors.bottomMargin: 5
color: "white"
font.pixelSize: 24
text:title
}
次のエラーが返されます。
QQuickText を QString に割り当てることができません
これを回避する方法はありますか?