March 4, 2012

Psycho_Path Psycho_Path
Lab Rat
19 posts

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?

6 replies

March 4, 2012

d2uriel d2uriel
Lab Rat
71 posts

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

 Signature 

“Do not judge, and you will never be mistaken.” - Jean-Jacques Rousseau

March 5, 2012

Andre Andre
Area 51 Engineer
6031 posts

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

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

March 5, 2012

fluca1978 fluca1978
Ant Farmer
524 posts

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.

March 5, 2012

Volker Volker
Robot Herder
5428 posts

If you really want to do it this way, use the static functions API of QMessageBox. They are easy to use and block until the box is dismissed.

March 6, 2012

foxyz foxyz
Lab Rat
30 posts

sums up,

  1. Try the debug tools like dbx on unix,gdb on linux first
  2. Try qDebug(”(%s,%d), your debug message”, FILE, LINE); or std::cout….
  3. use QMessageBox::information(NULL, “Debug Information”, QString(”%1,$2…Your debug message”).arg().arg()…);

[Edit: List formatting; mlong]

 Signature 

I just know coding and coding

March 7, 2012

Psycho_Path Psycho_Path
Lab Rat
19 posts

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

Cheers

 
  ‹‹ Defining structure types in a class      [Mac Lion] QT Won’t Compile ››

You must log in to post a reply. Not a member yet? Register here!