I found that if I used the following code, I encountered this error message: “Error: Unable to assign QColor to QString.”
Rectangle
{
anchors.fill: parent
color: "red"
Text
{
anchors.centerIn: parent
text: parent.color
}
}
If I modify the text property’s assignment statement as follows, it displays the HTML color code, presumably because it implicitly calls QColor::name() when appending a QString.
text: parent.color + ""
Just bear in mind I only did so to see the string representation of the color value.
↧








