我需要一個QProcess中連接到一個錯誤處理程序,但我不知道該如何傳遞錯誤字符串的插槽。以下是編譯,但不起作用。QProcess中ReadAllStandardError()
QString MainWindow::RunProcess(QString cstring)
{
QProcess *process = new QProcess(this);
connect(process,SIGNAL(readyReadStandardError()),this,SLOT(adberror(process::ReadAllStandardError())))
process->start(cstring);
}
void MainWindow::adberror(QString errtxt)
{
qDebug() << "error handler";
qDebug() << errtxt;
}
我可以引發一個進程錯誤,但adberror()從不觸發。
運行時,在應用程序輸出窗格中我看到:
QObject::connect: No such slot MainWindow::adberror(process::ReadAllStandardError())
QObject::connect: (receiver name: 'MainWindow')
編輯:這是Qt的5.6。我做了一個新的qmake/clean。
第一,您的信號和槽ARGS必須匹配更多的代碼..第二,ReadAllStandardError不會準備好! – HazemGomaa