Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1697141
  • 博文数量: 584
  • 博客积分: 13857
  • 博客等级: 上将
  • 技术积分: 11883
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-16 09:34

分类: 嵌入式

2011-04-08 11:20:16

  1. connect(&mProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(redFromStdOut()));
  2. connect(&mProcess, SIGNAL(readyReadStandardError()), this, SLOT(redFromStdErr()));
  3. connect(&mProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError)));
  4. connect(&mProcess, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus)));

  1. void FloodForecast::redFromStdOut()
  2. {
  3.   ui.textBrowse->append(mProcess.readAllStandardOutput());
  4. }



  5. void FloodForecast::redFromStdErr()
  6. {
  7.   ui.textBrowse->append(mProcess.readAllStandardError());
  8. }



  9. void FloodForecast::processError(QProcess::ProcessError error)
  10. {
  11.   if(error==QProcess::FailedToStart)
  12.   {
  13.     ui.textBrowse->append("程序启动失败.\r\n");
  14.   }
  15. }



  16. void FloodForecast::processFinished(int exitCode,QProcess::ExitStatus exitStatus)
  17. {
  18.   if(exitStatus == QProcess::CrashExit)
  19.   {
  20.     ui.textBrowse->append("程序异常终止.\r\n");
  21.   }
  22.   else
  23.   {
  24.     ui.textBrowse->append("程序正常结束.\r\n");
  25.   }
  26. }
阅读(3640) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~