qprocess 不触发 readyReadStandardOutput()

问题描述 投票:0回答:0

你好我有一个问题 qprocess readyReadStandardOutput,它不会被触发直到我调用 进程->closeWriteChannel();

我是这样开始我的过程的

 process = new QProcess();
    connect(process, SIGNAL(readyReadStandardOutput()), this, SLOT(response_adb()));
    process->setProcessChannelMode(QProcess::MergedChannels);

    process->setProgram("cmd.exe");
    process->setNativeArguments("/c adb.exe shell\r\n");


    process->start();

    process->waitForStarted();
    process->waitForReadyRead();

response_adb() 是这样的

void adbexe::response_adb()
{
    
        QString text2 = process->readAllStandardOutput();
        

        logbox->append(text2);
}

response_adb() 永远不会被调用,直到我调用我这样的关闭函数

void adbexe::close_adb(){

    process->closeWriteChannel();
    process->waitForFinished();
}
qt5 qprocess
© www.soinside.com 2019 - 2024. All rights reserved.