Hello. There is such a code:

QString test = QFileDialog::getOpenFileName(); QProcess *process = new QProcess(this); process->start(test); 

But when there are spaces on the way, QProcess gives an error:

Unknown error

How to run a file with spaces in the path using QFileDialog ?

    1 answer 1

    As always, you need to open the documentation and read. Everything is written there. The answer is simple - you need to quote.

     process->start("\"" + test + "\""); 

    however, if there are quotes inside the string, the task will be a bit more complicated.

    • Thanks, I saw this in the documentation, but did not understand how to use it. - SKIP