Hello,

I'm currently trying to create a modeless dialog box (or QMessageBox) using Qt 4.3 that:

1. gets created in my Main class
2. when it closes, it will call another function in the Main class that will exit the program.

In other words, I am looking for a modeless dialog box that will perform an exit once the users closes the dialog box. I've looked at some posts on the internet and a few in this forum but I can't seem to figure out how to do it. This thread was a little helpful:

http://www.qtforum.org/post/53763/re...less#post53763

where it gave the idea of connecting the destroyed() event to a slot, or reimplement closeEvent(). Here is a little portion of my code:

Qt Code:
  1. QMessageBox* pMessageBox = new QMessageBox(QMessageBox::Information,
  2. QObject::tr("My Software"),
  3. QObject::tr("Text in my dialog box."),
  4. 0,
  5. Qt::Dialog | Qt::WindowStaysOnTopHint );
  6.  
  7. pMessageBox->setModal(false);
  8. pMessageBox->show();
  9. //pMessageBox->activateWindow();
  10.  
  11. //connect(pMessageBox, SIGNAL(closeEvent()), this, SLOT(exitApp()));
  12. connect(pMessageBox, SIGNAL(destroyed()), this, SLOT(exitApp()));
To copy to clipboard, switch view to plain text mode 

But I don't seem to get the same result. The breakpoint in exitApp() never gets triggered.

I got a little excited when I saw documentation that you can set a flag in QMessageBox to make it modeless, but this was in another version of Qt and not in Qt 4.3.

Any ideas will be greatly appreciated.

Kat