转载请注明出处:http://blog.csdn.net/neochan1108/article/details/76687253
父窗体为QMainWindow;
当子窗体为:
1.QWidget,需要设置
this->setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog);
this->setWindowModality(Qt::WindowModal);
2.QDialog,需要设置
this->setWindowModality(Qt::WindowModal);
3.QMainWindow,需要设置
this->setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog);
this->setWindowModality(Qt::WindowModal);
如果需要类似查找功能:父窗体和子窗体都为QMainWindow,不用设置相关setWindowFlags和setWindowModality。