如果想输出DEBUG信息:
qDebug() << "Date:" << QDate::currentDate();
qDebug() << "Types:" << QString("String") << QChar('x') << QRect(0, 10, 50, 40);
qDebug() << "Custom coordinate type:" << coordinate;
如果想使用,COUT/IN需要使用QTextStream的重载
#include <QApplication>
#include <QTextStream>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QTextStream out(stdout);
out << "is QTextStream out " << endl;
return app.exec();
}
本文介绍了如何在Qt中使用qDebug()输出调试信息,并展示了如何利用QTextStream进行标准输出。通过具体的代码示例,读者可以了解到不同类型的变量是如何被打印出来的。

43

被折叠的 条评论
为什么被折叠?



