PDA

View Full Version : Recursive call detected



SebastianBecker
9th September 2009, 20:25
Hello.

I am using a main thread (GUI Thread) and multiple other threads for communication. The communication threads emit signals to the main thread. In the slots for those signals I open message boxes by using QDialog::exec(). Everything works alright if there is no open message. But if there is already an open message in the main GUI thread which has also been opened by using QDialog::exec() I get a Qt warning telling me that I am having a recursive call. But this is exactly what I want to do. Is there any other way than exec() to block the main thread in order to force my users to answer a certain dialog message?

Kind regards,
Sebastian

wysota
9th September 2009, 20:30
Are you sure you want to execute a loop that is already being executed? Maybe you want to execute some other loop?

SebastianBecker
10th September 2009, 08:41
Hello,

yes that is what I want to do. This is like a stacked message box in the main UI thread. Any other ideas how to realize that?

Kind regards,
Sebastian

wysota
10th September 2009, 18:25
This is like a stacked message box in the main UI thread.

Can you stack a message box over the same message box? Because I can only stack two message boxes one over the other... I don't see the point of executing a loop that is already being executed. It's like you wanted to show() a widget, then show() it again and then if you called hide() you would want it to still be visible (because show() was called twice)... It doesn't work that way. Call exec() once and don't call it again until the dialog exits the loop - you can't make a dialog modal to itself.