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: 214
Registered: ‎03-18-2012
My Device: 8520
My Carrier: Company
Accepted Solution

how to print QString on the console with qDebug() ?

Hi,

 

I print the String for log on the console with  methode 

qDebug("Fisrst Methode Work"); and it works fine.

 

but when i use

qDebug(contact.firstName());  it shows error ( no matching function for call to  qDebug(QString)' )

 

contact.firstName() return QString

 

Any Help? how to make the log of  QString...

 

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: how to print QString on the console with qDebug() ?

[ Edited ]

qDebug() << contact.firstName();

or

qDebug(contact.firstName().toUtf8());

 

To print multiple variables:

qDebug() << "name" << contact.firstName();

 

To remove spaces between them:

qDebug().nospace() << "name: " << contact.firstName();

 


Andrey Fidrya, @zmeyc on twitter