您的位置:首页 > 编程语言 > Qt开发

QT中如何进行DEBUG和使用cout,cin等

2011-11-17 13:49 911 查看
http://socol.iteye.com/blog/719500

QT中如何进行DEBUG和使用cout,cin等

博客分类:
QT

Qt

如果想输出DEBUG信息:

Qt代码







qDebug() << "Date:" << QDate::currentDate();
qDebug() << "Types:" << QString("String") << QChar('x') << QRect(0, 10, 50, 40);

qDebug() << "Custom coordinate type:" << coordinate;

qDebug() << "Date:" << QDate::currentDate();
qDebug() << "Types:" << QString("String") << QChar('x') << QRect(0, 10, 50, 40);
qDebug() << "Custom coordinate type:" << coordinate;


如果想使用,COUT/IN需要使用QTextStream的重载

Qt代码







#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(); }

#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();
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: