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

来源:互联网 发布:淘宝客服年度总结 编辑:程序博客网 时间:2024/06/05 03:57

如果想输出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();  }  


 

 

 

原创粉丝点击