Re: [Interest] QProcess overload slot connection

2019-03-14 Thread Thiago Macieira
On Thursday, 14 March 2019 09:59:33 PDT Jason H wrote: > At a minimum the docs should elaborate that finished() only happens after > started, and started only happens if the... process is scheduled? Not exactly. The problem is the asynchronous nature of fork()+exec() on Unix systems. On Windows,

Re: [Interest] QProcess overload slot connection

2019-03-14 Thread Jason H
> > > perhaps adding a QProcess::notRunning signal is in order? Or at least some > > > clarification in the docs? > > > > Sorry, no. Just the name of the signal you proposed shows it's a bad idea. > > Signals are always named after verbs in the past tense, indicating > > something > > that

Re: [Interest] QProcess overload slot connection

2019-03-14 Thread André Pönitz
On Thu, Mar 14, 2019 at 08:14:38AM -0700, Thiago Macieira wrote: > On Thursday, 14 March 2019 07:04:53 PDT Jason H wrote: > > perhaps adding a QProcess::notRunning signal is in order? Or at least some > > clarification in the docs? > > Sorry, no. Just the name of the signal you proposed shows

Re: [Interest] QProcess overload slot connection

2019-03-14 Thread Thiago Macieira
On Thursday, 14 March 2019 07:04:53 PDT Jason H wrote: > perhaps adding a QProcess::notRunning signal is in order? Or at least some > clarification in the docs? Sorry, no. Just the name of the signal you proposed shows it's a bad idea. Signals are always named after verbs in the past tense,

Re: [Interest] QProcess overload slot connection

2019-03-14 Thread Jason H
> > Because the NotRunning will occur always, and immediately, and finished > > won't. Failed command: > > stateCanged QProcess::Starting > > stateCanged QProcess::NotRunning > > // no finished! > > Good catch. A process that didn't start can't finish. > > Another way would be to

Re: [Interest] QProcess overload slot connection

2019-03-13 Thread Thiago Macieira
On Wednesday, 13 March 2019 14:08:19 PDT Jason H wrote: > In the situation that there's a problem, you end up waiting for timeout. > So: > connect(process,QOverload QProcess::ExitStatus>::of(::finished), , ::quit); > becomes: > connect(process, ::stateChanged,[=, ](QProcess::ProcessState > state)

Re: [Interest] QProcess overload slot connection

2019-03-13 Thread Jason H
> > What's the "right way" to connect QProcess::finished to QEventLoop::quit? > > The one you listed above. It turns out that I'm not even using that anymore. In the situation that there's a problem, you end up waiting for timeout. So: connect(process,QOverload::of(::finished), , ::quit);

Re: [Interest] QProcess overload slot connection

2019-03-13 Thread Jérôme Godbout
) , this , ::controllerError); -Original Message- From: Interest On Behalf Of Thiago Macieira Sent: March 13, 2019 4:22 PM To: interest@qt-project.org Subject: Re: [Interest] QProcess overload slot connection On Wednesday, 13 March 2019 12:02:14 PDT Jason H wrote: > conn

Re: [Interest] QProcess overload slot connection

2019-03-13 Thread Thiago Macieira
On Wednesday, 13 March 2019 12:02:14 PDT Jason H wrote: > connect(process, QOverload::of(::finished), , > ::quit); > > > QEventLoop::quit slot does not take any parameters > > > What's the "right way" to connect QProcess::finished to QEventLoop::quit? The one you listed above. -- Thiago

Re: [Interest] QProcess overload slot connection

2019-03-13 Thread Christian Ehrlicher
Am 13.03.2019 um 20:02 schrieb Jason H: This does not give an error, but is also wrong, I think: connect(process, QOverload::of(::finished), , ::quit); QEventLoop::quit slot does not take any parameters What's wrong with this? The signal can have more parameters than the signal - this was

[Interest] QProcess overload slot connection

2019-03-13 Thread Jason H
void waitForProcessFinished(QProcess *process, const QString , int timeout) { QTimer timer; QEventLoop loop; connect(, ::timeout, , ::quit); connect(process, ::finished, , ::quit); // can't resolve ::finished if (timeout > 0 ) {