本文整理汇总了C++中QProcess::processChannelMode方法的典型用法代码示例。如果您正苦于以下问题:C++ QProcess::processChannelMode方法的具体用法?C++ QProcess::processChannelMode怎么用?C++ QProcess::processChannelMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QProcess
的用法示例。
在下文中一共展示了QProcess::processChannelMode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
#ifndef QT_NO_PROCESS
QProcess process;
process.setProcessChannelMode(QProcess::ForwardedChannels);
if (process.processChannelMode() != QProcess::ForwardedChannels)
return -1;
process.start("testProcessEcho/testProcessEcho");
if (!process.waitForStarted(5000))
return -1;
if (process.write("forwarded\n") != 10)
return -1;
process.waitForReadyRead(250);
if (process.bytesAvailable() != 0)
return -1;
process.closeWriteChannel();
process.waitForFinished(5000);
#endif
return 0;
}
示例2: processChannelMode
QProcess::ProcessChannelMode QProcessProto::processChannelMode() const
{
QProcess *item = qscriptvalue_cast<QProcess*>(thisObject());
if (item)
return item->processChannelMode();
return QProcess::ProcessChannelMode();
}
示例3: readAllChannelsIntoDialog
void SyncProcess::readAllChannelsIntoDialog(QProcess& process, ProcessProgressDialog& dialog)
{
assert(process.processChannelMode() == QProcess::MergedChannels);
process.setReadChannel(QProcess::StandardOutput);
while (process.canReadLine())
{
const QString line = process.readLine();
dialog.insertStdOutLine(line);
}
}
示例4: main
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
if (argc < 3)
return 13;
#ifndef QT_NO_PROCESS
QProcess process;
QProcess::ProcessChannelMode mode = (QProcess::ProcessChannelMode)atoi(argv[1]);
process.setProcessChannelMode(mode);
if (process.processChannelMode() != mode)
return 1;
QProcess::InputChannelMode inmode = (QProcess::InputChannelMode)atoi(argv[2]);
process.setInputChannelMode(inmode);
if (process.inputChannelMode() != inmode)
return 11;
process.start("testProcessEcho2/testProcessEcho2");
if (!process.waitForStarted(5000))
return 2;
if (inmode == QProcess::ManagedInputChannel && process.write("forwarded") != 9)
return 3;
process.closeWriteChannel();
if (!process.waitForFinished(5000))
return 4;
if ((mode == QProcess::ForwardedOutputChannel || mode == QProcess::ForwardedChannels)
&& !process.readAllStandardOutput().isEmpty())
return 5;
if ((mode == QProcess::ForwardedErrorChannel || mode == QProcess::ForwardedChannels)
&& !process.readAllStandardError().isEmpty())
return 6;
#endif
return 0;
}