[SOLVED]multi-thread & network problem !
-
i use a new thread to tick Network IO.
and a QTimer ticking in the Main Thread to readData from the server.
also the data is sended from the Main Thread.
here is my question, eg:- i enter the login info in ClassA in the main thread, and send the info to the server;
- a func in ClassA is called in the QTimer in the Main Thread in order to process the readData from the server.
is it OK? and what should i do between the 2 step above, should i block the Main Thread until the step 2 succeed?
-
HI,
my suggestion is never block the Main Thread; if you need that the step 2 is completed before doing something else use a signal to tell the main thread the data are received
-
is there any way to make the whole window and controls Disable before step 2 is done?
-
Hi,
you can use
QWidget::setEnabled()
to disable and disable a Widget