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

Simon Hausmann Simon.Hausmann at qt.io
Wed Feb 27 07:34:27 CET 2019


I’m in favor of deprecating the static overloads. Compilers give nice deprecating warnings these days and the non-deprecated interface remains nice and clear.

Just my two cents,
Simon

> On 27. Feb 2019, at 02:56, Thiago Macieira <thiago.macieira at intel.com> wrote:
> 
> 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
> 
> 
> 
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development


More information about the Development mailing list