Call show() not exec() if you want a non-modal dialog.

Oh, and make sure you arrange to free the memory you allocated for dialog2.