1.新窗口界面focusPolicy设置为StrongFocus
2.重写showEvent函数
void ResetPasswordDialog::showEvent(QShowEvent *e)
{
if(this->focusWidget()){
this->focusWidget()->clearFocus();
}
ui->pushButton_ok->setAttribute(Qt::WA_UnderMouse,false);
this->setFocus();
QDialog::showEvent(e);
}
ui->pushButton_ok->setAttribute(Qt::WA_UnderMouse,false);
为设置按钮为非鼠标悬浮状态