Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
vingilot
Posts: 224
Registered: ‎03-29-2012
My Device: 9900

Setting Text in QML

Hello all, just adapting to the change in beta3, in beta 2 I was able to store text in a property variant and then assign the text of a TextArea this variant in the form:

 

property variant greeting: "hello"

 

TextArea{

text: greeting

}

 

this now gives an error type mismatch, expecting QString, found null. What alternative could I explore for this issue?

 

Thanks all.

Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Setting Text in QML

I'm not sure about the problem, but what if you try the type "string" instead of "variant" for that?

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
raj_jyani
Posts: 107
Registered: ‎05-11-2011
My Device: BlackBerry Z10 LE

Re: Setting Text in QML

Hi,

 

Try this

Page {
    property variant greeting: "hello"
    content: TextArea {
        text: qsTr(greeting)
    }
}

 or

Page {
    property string greeting: "hello"
    content: TextArea {
        text: greeting
    }
}