PDA

View Full Version : qprocess or qeventloop



knishaq
18th December 2009, 09:41
given the steps should occur in this order

a) call external qprocess:start("qconf -sq listL")
b) the output of this be stored in /tmp/tempfile.txt
c) this file is modified and saved
d) call external comm "qconf -Mq /tmp/tempfile.txt"

how is it possible to use qprocess only to do this. What i have observed is, qprocess will execute the external comm and the control comes back to the next line. this is where the file is being modified. and another qprocess is executed. now this seems fine for a single flow. But when this is to be done in a loop for a list of items (listL), then data in my file is not comprehensive. It comes as though things happened in a hurry ( because of which the second qprocess does not get executed successfully) . So my questions are,

1) is it possible to create user defined signals ( how ). such that i can call qprocess and trigger a signal ( execute [ step b step c ] ) after this happily execute another qprocess.
I mean i should have a way to control the flow, only after the file is traversed completely ( step b, step c) will the next qprocess be called.


alternatively,

2) will using event handlers ( user defined ) do the same thing as above.

relatively new to this, i would need an example.

wysota
20th December 2009, 10:14
Please don't start multiple threads on the same subject.

http://www.qtcentre.org/forum/f-qt-programming-2/t-qtconcurrent-26551.html

And to answer your question - you can connect to QProcess::finished() signal to trigger the next step of your work.