Debugging with message boxes using a widget application?
-
wrote on 3 Mar 2012, 23:33 last edited by
I'm trying to debug my application using message boxes as in VS2008, but unlike visual studios, the message boxes do not stop the code until they've been closed. Is there a way to make it so that the message box will force the user to close the box before the code progresses?
-
wrote on 4 Mar 2012, 08:16 last edited by
How do you instantiate the message boxes? It seems as your are creating modeless message boxes instead of modal ones.
-
wrote on 5 Mar 2012, 07:55 last edited by
Why do you use this way at all? Just use breakpoints for your debugger to step through your code.
-
wrote on 5 Mar 2012, 08:31 last edited by
You have to use mode dialogs to block the ui thread. However, I would use a real debugger or a qDebug() set of messages instead of that boring technique.
-
wrote on 5 Mar 2012, 12:45 last edited by
If you really want to do it this way, use the "static functions API":/doc/qt-4.8/QMessageBox.html#the-static-functions-api of QMessageBox. They are easy to use and block until the box is dismissed.
-
wrote on 6 Mar 2012, 08:51 last edited by
sums up,
Try the debug tools like dbx on unix,gdb on linux first
Try qDebug("(%s,%d), your debug message", FILE, LINE); or std::cout....
use QMessageBox::information(NULL, "Debug Information", QString("%1,$2...Your debug message").arg().arg()...);
[Edit: List formatting; mlong]
-
wrote on 7 Mar 2012, 01:31 last edited by
Thank you all for the replies. Will be trying the style I wanted initially and then probably break points followed by qDebug.
Cheers
1/7