Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

bool QProcess::waitForFinished ( int  msecs = 30000  ) 

Blocks until the process has finished and the finished() signal has been emitted, or until msecs milliseconds have passed.

Returns true if the process finished; otherwise returns false (if the operation timed out or if an error occurred).

This function can operate without an event loop. It is useful when writing non-GUI applications and when performing I/O operations in a non-GUI thread.

Warning:
Calling this function from the main (GUI) thread might cause your user interface to freeze.
If msecs is -1, this function will not time out.

See also:
finished(), waitForStarted(), waitForReadyRead(), waitForBytesWritten()

Definition at line 1286 of file qprocess.cpp.

References QTime::elapsed(), QTime::start(), started(), and waitForStarted().

Referenced by close(), QAssistantClient::closeAssistant(), execute(), and ~QProcess().

{
    Q_D(QProcess);
    if (d->processState == QProcess::NotRunning)
        return false;
    if (d->processState == QProcess::Starting) {
        QTime stopWatch;
        stopWatch.start();
        bool started = waitForStarted(msecs);
        if (!started)
            return false;
        if (msecs != -1)
            msecs -= stopWatch.elapsed();
    }

    return d->waitForFinished(msecs);
}


Generated by  Doxygen 1.6.0   Back to index