You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

ods15

Unregistered

1

Saturday, September 25th 2004, 1:34pm

wait for signal

i am looking for a rather simple function in the qt documentation, and am so far surprised i could not find it and it apperantely doesnt exist i am looking for a function, which simply WAITS, until a certain signal has been emitted. so instead of having to use 2 functions and connect, i'd just use one function, easy example for this:

QProcess bla(QStringList("something"));
bla.launch();
// do whatever
bla.kill(); // i want a hard kill.
// and now, i want to be sure its dead.

wait_signal(&bla,SIGNAL(processExited()));


this is the function i am missing, and i cant find such a thing. using connect and a seperate function is not good enough for me, as it doesnt freeze the program until its done. the entire function needs to happen in one go. without interruptions.

Posts: 2,162

Location: Graz, Austria

Occupation: Student

  • Send private message

2

Saturday, September 25th 2004, 6:18pm

Why do you want to freeze the application?
The user will assume that it has crashed and kill it.

Anyway, QProcess is explicitly for non-blocking execution of external programs, if you want to block, you can use the traditional system functions system(), execv() and friends or popen

Cheers,
_
Qt/KDE Developer
Debian User

hatulflezet

Professional

Posts: 1,301

Location: Munich Germany

Occupation: Programmer

  • Send private message

3

Saturday, September 25th 2004, 6:18pm

from QProcess docs:

Quoted

The object emits the signal launchFinished() when this function call is finished. If the start was successful, this signal is emitted after all the data has been written to standard input. If the start failed, then this signal is emitted immediately.


Now in regard to the general need of the "wait" function you mentioned, this function is not needed - since all slots are "wating" for a signal (to which they are connected) to be fired by defenition.
The signal/slot behaviour implements exactly that "wating" function through the way its contructed.
Click here! I dare ya'!! :]
Project Archimedes
----------------------------------------------------------
"Don't panic, and thanks for all the fish!"