QT中进行debug输出和使用cout cin等的问题
来源:互联网 发布:58同城网招聘淘宝客服 编辑:程序博客网 时间:2024/05/29 03:08
在qt中大家都知道不能像纯C++那样使用cout等进行debug, 因为输出的内容会保留到程序退出的时候才进行输出。
Warning and Debugging Messages
Qt includes four global functions for writing out warning and debug text. You can use them for the following purposes:
Qt中包含了四个全局方法, 用于输出警告和调试信息, 列举如下:
- qDebug () is used for writing custom debug output.用于输出调试信息
- qWarning () is used to report warnings and recoverable errors in your application.警告信息
- qCritical () is used for writing critical error mesages and reporting system errors.严重错误信息
- qFatal () is used for writing fatal error messages shortly before exiting.很严重的错误, 输出后退出程序
If you include the <QtDebug> header file, the qDebug() function can also be used as an output stream. For example:
如果你include了<QtDebug>头文件, 上述的方法都可以当输出流进行使用, 例如:
qDebug() << "Widget" << widget << "at position" << widget->pos();
如果想要使用cout, 应使用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();
- }
0 0
- QT中进行debug输出和使用cout cin等的问题
- QT中进行debug输出和使用cout cin等的问题
- QT中如何进行DEBUG和使用cout,cin等
- QT中如何进行DEBUG和使用cout,cin等
- QT中如何进行DEBUG和使用cout,cin等
- QT中如何进行DEBUG和使用cout,cin
- QT中使用DEBUG,cout,cin
- QT中如何使用cout cin cerr 进行输入和输出
- QT中使用cin,cout,cerr等
- 关于Qt无法直接使用cout和cin的问题
- 关于Qt无法直接使用cout和cin的问题
- QT: 在QT程序中使用cout和cin
- QT: 在QT程序中使用cout和cin
- cin和cout的使用
- Qt中无法直接使用cout,cin
- Qt中使用cout, cin, cerr
- QT中使用cin,cout ,cerr
- Qt中使用cout, cin, cerr
- 推荐一些自己觉得好用的Sublime Text3插件
- 获得UIAlertView的输入值
- 11.7学习内容
- c++读写文件流
- LeetCode Same Tree
- QT中进行debug输出和使用cout cin等的问题
- Sicily 题目分类
- 隐含语义索引(Latent Semantic Indexing )
- PHP验证图片制作
- python 内置函数 map、 reduce 、filter
- linux awk命令详解
- 阿里巴巴java研发成功笔面试总结
- OpenVPN优化之-巨型帧
- 归并排序