2
我使用QProcess並將其readyReadStandardOutput連接到插槽。但開槽後執行兩次。請告訴我爲什麼?爲什麼QProcess信號readyReadStandardOutput()出現兩次?
{
myProcess = new QProcess(parent);
myProcess->start("mayabatch.exe -file "+scene);
connect(myProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readOutput()));
}
void MainWindow::readOutput()
{
qDebug()<<"Read";
QByteArray outData = myProcess->readAllStandardOutput();
qDebug()<<QString(outData);
}
OUTPUT:
Read
"File read in 0 seconds.
"
Read
"cacheFi"
Read
"le -attachFile -fileName "nClothShape1" -directory ...
最後一個字符串被打破。單詞之間出現「閱讀」。