Dialog 窗口在调用exec前,先调用setWindowModality(Qt::WindowModal)这一句话; 如果窗口变成非模态,就在该窗口的构造函数调用setWindowFlags(Qt::Dialog);