1.让QMainWindow窗口在QDialog窗口上面置顶层,默认是置QDialog窗口的底层
setWindowFlags(Qt::Dialog);
或者
子窗口名:
userManagerDialog
Qt::WindowFlags flags = Qt::Dialog;
userManagerDialog->setWindowFlags(flags);
Qt::WindowFlags flags = Qt::Dialog;
userManagerDialog->setWindowFlags(flags);
2.弹出子窗口时禁用主窗口
userManagerDialog->setWindowModality(Qt::ApplicationModal);
//阻塞除当前窗体之外的所有的窗体
3.获取当前窗体的左上角坐标
int x = this->geometry().x();
int y = this->geometry().y();
int y = this->geometry().y();