本文整理汇总了C++中QProcess::connect方法的典型用法代码示例。如果您正苦于以下问题:C++ QProcess::connect方法的具体用法?C++ QProcess::connect怎么用?C++ QProcess::connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QProcess
的用法示例。
在下文中一共展示了QProcess::connect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _run_stuff
void TestBinRunner::_run_stuff()
{
///
/// initialization
// get arguments
// avoid first argument (i.e., parent binary)
QStringList args;
for (int i = 1; i < _argc; i++)
args << _argv[i];
// declare process and output binder
QProcess* pro;
QtOutputBinder* qob;
///
/// execute tests binaries
for (std::list<TestSuiteDescriptor>::const_iterator ci = _testbins.begin();
ci != _testbins.end();
++ci){
// get path and name
QString binid((*ci).id.c_str());
QString binpath((*ci).path.c_str());
QString bindesc((*ci).description.c_str());
_running_instance = (*ci);
std::cout << "+---------------------------------------------------------" << std::endl
<< " Executing: " << binpath.toStdString() << std::endl;
// execute test bin
// create process and connect output
pro = new QProcess();
qob = new QtOutputBinder(pro);
qob->set_enabled(true);// enable for debugging
// connect signal handlers
pro->connect(pro,SIGNAL(error(QProcess::ProcessError)),this, SLOT(_qprocess_error_handler(QProcess::ProcessError)));
//pro->connect(pro,SIGNAL(finished(int,QProcess::ExitStatus)),this, SLOT(_qprocess_finished_handler(int,QProcess::ExitStatus)));
// execute binary and wait for it
pro->start(binpath,args,QIODevice::ReadWrite | QIODevice::Text);
if(!pro->waitForFinished()) // beware the timeout default parameter
{
std::cerr << "Error: Executing program failed with exit code " << pro->exitCode() << std::endl;
_qprocess_error_handler(pro->error());
}
// do output stuff
std::cout << " Collecting output" << std::endl;
_do_output_options();
// clean
pro->close();
delete pro; delete qob;
std::cout << " Finished" << std::endl;
// sleep if set
_check_pause_between();
}
}