Qt-interest Archive, March 2002
Console App and blocking function call
Message 1 in thread
I have a request to provide a blocking function call to do some file copies
for a console app (Windows 2000).
Simple solution was to use the Network Protocols inside the function, but
they return immediately and do their work, sending signals until "finished".
This causes my function to return as soon as the copy starts, not when it is
finished. If I start the copy operation and WaitFor an event that gets
triggered by the finished signal, the QApplication object never executes,
because the function call has blocked.
So, it seems that I have to get the QApp's msg loop going before the calls
to the function. Could use another QApp in the function, but that wouldn't
work for users of the function with QT GUI apps. What to do???
John P. Cadman
Pipeline Technology, Inc.
office:858.909.0527
cel: 760.415.9080
jcadman@pipelinetechnology.com
Message 2 in thread
If I understand correctly, you want to start some file copies, *wait for
them to finish*, then move on with your application? I have something
similar to this going on right now, and my approach is this: start the
transfers (assuming you're using something like the QUrlOperator here), then
connect in to the fileTransferProgress signal [not positive about name, read
the docs -- sorry] and wait for it to tell you all the data has been
transferred. It's a bit complicated this way, but the upside is that you
can keep your user updated (if you so desire) as to how close the transfers
are to done. When all your transfers tell you they're done, you can fire
off a function to start your "primary" application.
R/
James
----- Original Message -----
From: "John P. Cadman" <jcadman@pipelinetechnology.com>
To: "QT Interest List" <qt-interest@trolltech.com>
Sent: Friday, March 08, 2002 1:29 PM
Subject: Console App and blocking function call
> I have a request to provide a blocking function call to do some file
copies
> for a console app (Windows 2000).
> Simple solution was to use the Network Protocols inside the function, but
> they return immediately and do their work, sending signals until
"finished".
> This causes my function to return as soon as the copy starts, not when it
is
> finished. If I start the copy operation and WaitFor an event that gets
> triggered by the finished signal, the QApplication object never executes,
> because the function call has blocked.
>
> So, it seems that I have to get the QApp's msg loop going before the calls
> to the function. Could use another QApp in the function, but that
wouldn't
> work for users of the function with QT GUI apps. What to do???
>
> John P. Cadman
> Pipeline Technology, Inc.
> office:858.909.0527
> cel: 760.415.9080
> jcadman@pipelinetechnology.com
>
> --
> List archive and information: http://qt-interest.trolltech.com