Debugging with message boxes using a widget application?



  • 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?



  • How do you instantiate the message boxes? It seems as your are creating modeless message boxes instead of modal ones.



  • Why do you use this way at all? Just use breakpoints for your debugger to step through your code.



  • 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.



  • 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.



  • 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]



  • Thank you all for the replies. Will be trying the style I wanted initially and then probably break points followed by qDebug.

    Cheers


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.