Derive your widget from QDialog instead of QWidget and call QDialog::setModal() or QDialog::exec().
By the way, a modal non-dialog window is some kind of misdesign.