[Qt-interest] QDialog::exec VS QDialog::show

Ross Bencina rossb-lists at audiomulch.com
Thu May 6 01:42:45 CEST 2010


subject: QDialog::exec  VS QDialog::show
> What's the difference between the two functions?

exec() maintains its own event loop and returns when the dialog box is 
closed. show() shows the window and returns immediately.

If it's a modal dialog and you need to know what the user selected in the 
dialog box at the point of call then it's usually easier to use exec().

Because exec() runs its own nested event loop, this can be a problem in a 
few cases (for example main loop timers may not be called on some 
platforms). Even so, if you think you need exec() it's probably the right 
choice.

Ross. 




More information about the Qt-interest-old mailing list