javascript - unable to assign QQuickText to QString -
i trying dynamically create objects in qml-javascript.the function creates object is:
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}); }
the recieving file(flickitem.qml) has property string title later assigned text field of text item:
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 }
the following error returned:
unable assign qquicktext qstring
any way around this?
rectangle { id: name //... property string title: "" <------ title //... } text { //... id: title <----- title //... text:title <---- title ?!?!?! }
the problem have property
bound title identifier, , id
bound title identifier. based on output, trying assign text id
(and not property
).
changing id
of text
component should solve problem.
Comments
Post a Comment