PDA

View Full Version : QThread, QMessageBox, gui thread



TheKedge
25th October 2006, 12:02
Hello all,

simple question: I'm in a thread and would like to pop up a QMessageBox, how do I do it?
At the moment I get a crash which says that widgets must be created in the Gui thread. My thread can take minutes (or hours) and will need to tell the user if something is not happening properly - any suggestions?

thanks
K

jpn
25th October 2006, 12:23
You will have to, the way or other, deliver the message to the main GUI thread and show a message box there. As the error provided by Qt states, all widgets must be created in the main GUI thread. The same goes for modifying the GUI.

If you just want to show and error message in a non-interactive way, meaning the the user cannot choose anything, it should be pretty much simple to emit a signal from the thread with the error message as a parameter and then show it in the GUI thread.