how to select file from a QThread
-
Hi all,
How to select a file with QFileDialog in a running QThread, and wait the result?I've tried with signals&slots but it's a async technique.
Some help?
:) -
why you need this feature?
GUI can be run only from main thread
-
@mcosta yep, this is the problem :(
My application implement a thread based httpserver. One service is to select a file and get the path. -
-
@mcosta the thread open the socket and read http request, and should get back the response..... in this case the path of a selected file!!! any tips?
-
http requests shall be served in few seconds otherwise you can have timeout.
-
you can send a signal to the gui when the server receives requests. the gui can open the dialog and send back the path.
The problem is to handle correctly the requests timeout. HTTP has special code (IIRC 100) for long operation
-
A Gui widgets can only use it in main thread but you can use Signal-Slot with Qt::QueedConnexion if you want your widget d'ont freeze
-
@Malek_Khlif said:
A Gui widgets can only use it in main thread but you can use Signal-Slot with Qt::QueedConnexion if you want your widget d'ont freeze
mmmm thanks malek, can you make me an example?
-
@mcosta said:
you can send a signal to the gui when the server receives requests. the gui can open the dialog and send back the path.
The problem is to handle correctly the requests timeout. HTTP has special code (IIRC 100) for long operation
MMMMMMMM, maybe it could be a problem.... some other opinion ?
-
Hi,
That sounds a bit like reverse logic. Can you explain your application work flow ?