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

来源:互联网 发布:软件开发平台是什么 编辑:程序博客网 时间:2024/06/06 06:38

如果想输出DEBUG信息:

Qt代码
  1. qDebug() << "Date:" << QDate::currentDate();  
  2. qDebug() << "Types:" << QString("String") << QChar('x') << QRect(0105040);  
  3. qDebug() << "Custom coordinate type:" << coordinate;  

 

 

 

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

 

 

Qt代码
  1. #include <QApplication>  
  2. #include <QTextStream>  
  3.   
  4. int main(int argc, char *argv[])  
  5. {  
  6.     QApplication app(argc, argv);  
  7.   
  8.     QTextStream out(stdout);  
  9.   
  10.     out << "is QTextStream out " << endl;  
  11.   
  12.     return app.exec();  
  13. }  
原创粉丝点击