使用这个方法setTabOrder(),设置使得焦点的顺序从前到后依次是:
ui->lineEdit=》 ui->lineEdit_2=》ui->lineEdit_3 =》ui->lineEdit_4
焦点先在ui->lineEdit上,当按下Tab键时,焦点跑到ui->lineEdit_2上。。。按照设定顺序依次向后!
setTabOrder(ui->lineEdit, ui->lineEdit_2); //1->2
setTabOrder(ui->lineEdit_2, ui->lineEdit_3); //2->3
setTabOrder(ui->lineEdit_3, ui->lineEdit_4); //3->4
如下图:
原文链接:https://blog.csdn.net/wzz953200463/article/details/124110142