PDA

View Full Version : a question conerning code in main.cpp



nass
19th September 2006, 16:42
hello everyone,
i have made a gui application in qt that now needs to share some variables with another application... the other application is going to write values in a shared memory and then send a signal that the gui will catch and go read these values from a common file.

i have declared - on the gui part - my shared variables, and a public procedure (getVarsFromFile) that opens the shared file and reads the variables from it...
i also guess that i am to write a small procedure (void caught_a_signal() ) in the main.cpp that gets called when a signal is sent.. now what i think of doing is call the myForm->getVarsFromFile() within the caught_a_signal() procedure... but of course the problem that arises there is that myForm is not declared in the scope of that procedure, only in main{}. so what can i do? how can i declare the myForm so that it can be seen from the procedure too?
thank you for your help
nass

wysota
19th September 2006, 17:55
I think you should post an event to the event queue in the signal handler. This way you can then handle the event inside the application using customEvent().