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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Cascades Development

Reply
Developer
vingilot
Posts: 224
Registered: ‎03-29-2012
My Carrier: Wind

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.

Please use plain text.
Developer
peter9477
Posts: 5,630
Registered: ‎12-08-2010
My Carrier: none

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 -- (PlayBook 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!
Please use plain text.
Developer
raj_jyani
Posts: 100
Registered: ‎05-11-2011
My Carrier: AirTel

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
    }
}

 

Please use plain text.