[Development] Deprecating the static QProcess::startDetached() overloads

Thiago Macieira thiago.macieira at intel.com
Wed Feb 27 02:53:25 CET 2019


With a lot of thanks to Jörg's effort, since Qt 5.9 we have a non-static 
startDetached() method, which do honour the environment set with 
setProcessEnvironment, the current working dir with setWorkingDirectory, etc.

I think it's a far superior option. By far, it avoids the mistake that led to 
QTBUG-74074, where someone wrote:

    QProcess exeB;
    QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
    env.insert("PYTHONHOME", "NewVariable");
    exeB.setProcessEnvironment(env);
    exeB.startDetached("AnotherProcess/AnotherProcess.exe");

Unfortunately, that startDetached is static, so the setting made in the object 
are not relevant. The author needed to write:

    exeB.setProgram("AnotherProcess/AnotherProcess.exe");
    exeB.startDetached();

Ok to deprecate it?

We will not be able to recover those overloads in Qt 6, but we may be able to 
bring them back in Qt 7.

Alternative: deprecate *ALL* startDetached() overloads and instead add a 
setDetachedMode(bool enable), and allow start() to start detachedly.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel System Software Products






More information about the Development mailing list