Client / Server apps
-
I'm working on client / server applications, when the file transfer starts the server displays a progress dialog to show the transfer. The client also has a similar dialog, the problem is that it isn't showing.
If I pause the server during a send the client dialog will appear, but it will not appear unless I pause the server.
For testing both the client and server are running on the same computer, I'm guessing the client is to busy for the progress dialog to be displayed until I pause the server.
Is there anything I can do to ensure that when I call show on the client that the dialog is actually displayed?
-
@SPlatten said in Client / Server apps:
Is there anything I can do to ensure that when I call show on the client that the dialog is actually displayed?
Don't block event loop...
Most probably you're blocking event loop. But without more information from your side others can only guess... -
Calling QWidget::show() does not immediately show the widget; the widget is shown when the Qt event loop is entered. In main() that is when you call QApplication::exec(). Similarly, updates to the widget visual are executed, when needed, by the event loop (e.g. in response to to a refresh triggered by calling QWidget::update()). If your code does things that block the program thread of execution returning to the event loop then visual updates (and asynchronous network activity etc) cease. This is very likely what you are doing, and a very common mistake.