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
Posts: 26
Registered: ‎07-22-2014
My Device: Z30, Z10, Q10, Passport
My Carrier: Telus

Re: How to get HardwareInfo in QML?

I'm having the same problem.  I can use it when labelling buttons etc but when trying to use it to creat a string that is used as a datasource I just get 'undefined'.  

Developer
Posts: 543
Registered: ‎08-31-2013
My Device: Q10, Z10LE, Nokia N950, DAB....
My Carrier: Telekom Slovakia

Re: How to get HardwareInfo in QML?

As BlackBerry Development Advisor

You guys have something wrong in your code because this works perfect Smiley Wink

import bb.cascades 1.2
import bb.device 1.2 // for HardwareInfo

Page{
            
    attachedObjects: [
        HardwareInfo {
            id: info
        }
    ]

    WebView {
        horizontalAlignment: HorizontalAlignment.Fill
        verticalAlignment: VerticalAlignment.Fill
        url: "http://test/"+info.pin
        onUrlChanged: {
            console.log("URL: "+url)
        }
    }
            
}

 



If helped give a like. If your problem was solved mark the post as "Solution"
Portfolio: BlackBerry Nokia
Social: Twitter | Facebook
About Me / Blog DevPDA | Blog
Developer
Posts: 26
Registered: ‎07-22-2014
My Device: Z30, Z10, Q10, Passport
My Carrier: Telus

Re: How to get HardwareInfo in QML?

YES!!!! This is exactly what I needed, thank you very much.  If only I could go back and reclaim the two days I spent trying to figure this out.  Smiley Happy 

 

Anyway, your solution worked perfectly.