In Qt application, outputting printf-like formatted debug message involving QString means using latin1 or utf8 such as:
QString name = "Willy Wonka"; int num = 5; qDebug("My name is %s, I invite %d children", name.latin1(), num);
But in Qt 4.x, you can use qPrintable function:
QString str = "a chocolate factory"; qDebug("I have %s", qPrintable(str));
For non-formatted output, just use qDebug() as an output stream.
No comments:
Post a Comment