onTextChanged Topic
-
hello
i have a rectangle and text inside a rectangle,
im making use property, property string typestring= "",
first it will be nullthen making use of onTextChanged,
i need to update text inide the rectangle, help me out.code is:
// parent rectangle
Rectangle {
id: root
width: 500
height: 500// making use of property which at first will be null
property string typestring: ""// one more rectangle, child of root
Rectangle
{
id: rect1
width: 100
height: 100
color: "blue"
// text inside the rect1
Text {
id: t1
color: "black"
anchors.centerIn: parent
onTextChanged:
{if(condition)
{
typestring == " some text" // has to get printed in text
}
else if(condition)
{
typestring = "text" // this has to printed in text of rectangle
}
}
}
}but im getting nothing in text,
if i make use property string typestring = "hello"
in that case only hello is printed,
i need with respect to some condition in if else, that string has to get printed in text of rectangle. -
@Pradeep-Kumar As said earlier please edit the post and put code markers.
-
kk i'l do it
import QtQuick 1.1
Rectangle {
property string typestring: ""Rectangle { Text { id: t1 anchors.centerIn: parent
onTextChanged:
{if(condition)
{
typestring == " some text" // has to get printed in text
}
else if(condition)
{
typestring = "text" // this has to printed in text of rectangle
}
}
}
}
}the information has to appear in Text, based on codition in onTextChanged, please help me.