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
Highlighted
Developer
Posts: 188
Registered: ‎07-19-2012
My Device: Z10 Limited Edition and Dev Alpha C
My Carrier: Movistar-Venezuela

Problem with the library Line

hello brothers, I have a problem with the library Line.

 

in myapp.cpp 

 

this error:

 

Multiple markers at this line

- no matching function for call to 'bb::cascades::QmlDocument::setContextProperty(const char [6],
bb::system::Line*)'
- candidate is:

 

#include <bb/system/phone/Line>
qml->setContextProperty("_line", &lineInfo);

 

myapp.hpp

 

#include <bb/system/phone/Line>
bb::system::phone::Line lineInfo;

 

main.cpp

 

#include <bb/system/phone/Line>
qmlRegisterUncreatableType<bb::system::phone::Line>("bb.system", 1, 0, "Line");

 

app.qml

 

            Container {
                                Label {
                                    text: "ID Number:"
                                    textStyle.fontSize: FontSize.Small
                                    textStyle.fontSizeValue: 1.0
                                    textStyle.color: Color.Black
                                }
                                Label {
                                    text: _line.id
                                    textStyle.fontSize: FontSize.Small
                                    horizontalAlignment: HorizontalAlignment.Right
                                   
                                    textStyle.color: Color.Black
                                }
                                background: Color.DarkGray
                                preferredWidth: 770.0
                                layout: DockLayout {
                                }
                            }   

this is tuto: http://developer.blackberry.com/cascades/reference/bb__system__phone__line.html#function-id 

 

QString id ()

Returns the ID of the line.

Return:
The line ID. If the line is invalid, the return value is undefined.

because it is the error? and how do I display the ID line in a Label qml.?


Follow me in Twitter:

@Marcossit

BBM Channel:

MarcossitDev: C0002C366  

DeviceSuite For BlackBerry 10:

Link to Download DeviceSuite:

Support was successful? Accept as Solution and click on:


Developer
Posts: 610
Registered: ‎10-17-2010
My Device: (BlackBerry Z10)-> Q10/Passport Dual Use

Re: Problem with the library Line

BUMP for working sample.

Developer
Posts: 610
Registered: ‎10-17-2010
My Device: (BlackBerry Z10)-> Q10/Passport Dual Use

Re: Problem with the library Line

This code works. Feel free to use it for your own projects

 

bb::system::phone::Phone _phone;
bb::system::phone::Line _line = _phone.lines().value("cellular");
qDebug()<<_line.address();
qDebug()<<"phone is "<<_line.address();