Labels

Wednesday, August 3, 2011

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

 

如果想输出DEBUG信息:

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


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


Qt代码
  1. #include <QApplication>
  2. #include <QTextStream>
  3. int main(int argc, char *argv[])
  4. {
  5. QApplication app(argc, argv);
  6. QTextStream out(stdout);
  7. out << "is QTextStream out " << endl;
  8. return app.exec();

No comments:

Post a Comment