'Connect Qprocess signal to slot

In the function below, how do I connect the process signal errorOccured to a slot? My goal is to qDebug the errorOccurred property when process.startDetached() runs.


void MainWindow::on_pushButton_clicked()
{

    qDebug() << "Start Detached";
    QProcess process;
   
    connect(process, SIGNAL(errorOccurred()), this, 
    SLOT(onSdetacherror()));

    process.setProgram("C:/windows/system32/cmd.exe");
    process.setArguments({"/k"});
    process.startDetached();


}

The proper connect syntax is eluding me ...



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source