unable to assign QQuickText to QString
javascript, qml, qstring
Solution
Rectangle {
id: name
//...
property string title: "" <------ title
//...
}
Text {
//...
id: title <----- title
//...
text:title <---- which title ?!?!?!
}
The problem is you have a `property` bound to the title identifier, and an `id` bound to the title identifier. Based on your output, you are likely trying to assign text from the `id` (and not the `property`).
Changing the `id` of your `Text` component should solve your problem.
Problem
I am trying to dynamically create objects in qml-javascript.The function which creates the 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 a property string title which is later assigned to the text field of the 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 is returned: unable to assign QQuickText to QString Any way around this?