http://socol.iteye.com/blog/719500
QT中如何进行DEBUG和使用cout,cin等
- 博客分类:
- QT
如果想输出DEBUG信息:
- 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的重载
- #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(); }