You usually don't need to set the modality of a dialog.
show() brings it up as a non-modal dialog and exec() brings it up as modal.

From a quick look your Next_Page window should open, but of course Main_Page will not (Mpage doesn't live long enough).

Cheers,
_