想让一个QWidget成为模态,我们只需要对其设置:
setAttribute(Qt::WA_ShowModal, true);
注意:这是QWidget的成员函数 ,也就是说,QWidget可以显示为模态或非模态!