PDA

View Full Version : QTcpServer problem in Python Qt



mejustme
25th June 2008, 16:50
Hello.

I'm using PyQt 4.2.
My application uses a QTcpServer to implement the comunication between to GUI classes. (I want to send a message from one to another).

I have class that extends QThread, which executes an infinite loop and listens to incomming connections. I also send messages from this thread. The application works fine when i use it as a member of GUI class. But when i use it as a standalone application in a main I don't receive any connections. :confused:

Can anyone help.

The Storm
25th June 2008, 18:33
Did you call the exec() function in your Thread class run() function? This is needed to make your signals and slots to work. :)

mejustme
26th June 2008, 14:49
No , i'm not using exec() in run(), but the problem was related to exec() :
I was creating a QApplication object, then opened an window and called exec_() to start the event loop. Then , after that window was closed i was creating by mistake another QApplication object for some other window and again _exec(). It works now, when i use just one QApplication and create one window from which I show the rest of the windows

10x :)