void waitForProcessFinished(QProcess *process, const QString &command, int
timeout) {
QTimer timer;
QEventLoop loop;
connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit);
connect(process, &QProcess::finished, &loop, &QEventLoop::quit); //
can't resolve &QProcess::finished
if (timeout > 0 ) {
timer.setSingleShot(true);
timer.start(timeout);
}
process->start(command);
loop.exec();
}
I can't seem to figure this out. There is code online that resolves it as
above, but there is also code that uses qOverload() but I get:
use of undeclared identifier 'qOverload'
So you say that's only availible for C++14, ok I say:
connect(process, QOverload<>::of(&QProcess::finished), &loop,
&QEventLoop::quit);
which then gives:
no matching function call to 'of'
QOverload<void> gives an error
This does not give an error, but is also wrong, I think:
connect(process, QOverload<int>::of(&QProcess::finished), &loop,
&QEventLoop::quit);
QEventLoop::quit slot does not take any parameters
What's the "right way" to connect QProcess::finished to QEventLoop::quit?
_______________________________________________
Interest mailing list
[email protected]
https://lists.qt-project.org/listinfo/interest