免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1231 | 回复: 0
打印 上一主题 下一主题

qt 中一种很好的显示调试信息的方法 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-01-13 21:00 |只看该作者 |倒序浏览

                                这个代码是从qui4mplayer(基于qt 3.3.5) 这中看到的,这个函数可以被用来在需要显示 *调试信息* 的时候。
发出一个信号,让该槽执行,利用它打印调试信息。
在这个例子里,调试信息来自mplayer播放的“文字输出”。
// Slot that can have any particular signal connected to it to test various things
void PlayFile::debugslot()
{
cout canReadLineStderr())
cout readLineStderr() class myclass{
private:
QString debugMsg;
void    init();
...
public:
void doSomeThing();
...
signal:
needDebug();
...
public slot:
void debugslot();
...
};
void myclass::init()
{
...
connect(this,needDebug,this,debugslot);
}
myclass::doSomeThing()
{
...
debugMsg = state;
emit needDebug();
}
void debugslot( )
{
cout "debug info: "debugMsg.latinl()endl;
}


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/61322/showart_1795875.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP