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

yifli at mtu.edu yifli at mtu.edu
Thu May 6 01:58:18 CEST 2010


Thank you all for the explanation!

Yifei

> 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