how to select file from a QThread
-
wrote on 12 Mar 2015, 16:18 last edited by xalisonx 3 Dec 2015, 16:18
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?
:) -
wrote on 12 Mar 2015, 16:57 last edited by
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. -
-
wrote on 12 Mar 2015, 17:18 last edited by
http requests shall be served in few seconds otherwise you can have timeout.
-
wrote on 12 Mar 2015, 17:26 last edited by
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
-
wrote on 12 Mar 2015, 19:04 last edited by
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
-
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
wrote on 17 Mar 2015, 08:17 last edited by@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?
-
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
wrote on 17 Mar 2015, 08:18 last edited by@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 ?
1/11