QPushButton is in focus when QDialog is loaded
Unsolved
General and Desktop
-
wrote on 27 Apr 2016, 14:45 last edited by
Hi,
On the data entry form I set the tab order with the following code:LineEdit_Name->setFocus (); QWidget::setTabOrder(LineEdit_Name,What_Combo); QWidget::setTabOrder (What_Combo,Image_Button); QWidget::setTabOrder (Image_Button,Material_Combo); QWidget::setTabOrder (Material_Combo,color_Combo); QWidget::setTabOrder (color_Combo,descr_TextEdit); QWidget::setTabOrder (descr_TextEdit,month_Combo); QWidget::setTabOrder (month_Combo,day_Combo); QWidget::setTabOrder (day_Combo,year_Combo); QWidget::setTabOrder (year_Combo,signedby_Combo); QWidget::setTabOrder (signedby_Combo,history_TextEdit); QWidget::setTabOrder (history_TextEdit,age_LineEdit); QWidget::setTabOrder (age_LineEdit,notes_TextEdit); QWidget::setTabOrder (notes_TextEdit,SubmitButton);
Though Image_Button is the third it is always in focus when QDialog is loaded and when Enter is pressed to exit any of the combo boxes Image_Button is triggered. How can I make Image_Button out of focus?
Thank you. -
wrote on 27 Apr 2016, 17:44 last edited by
This is due to the autoDefault http://doc.qt.io/qt-5/qpushbutton.html#autoDefault-prop
-
This is due to the autoDefault http://doc.qt.io/qt-5/qpushbutton.html#autoDefault-prop
wrote on 28 Apr 2016, 03:41 last edited by@VRonin
Hi,
I usedImage_Button->setAutoDefault (false); Image_Button->setDefault (false);
which worked on the Image_Button, but instead the focus shifted on the submit button.
setDefault() or setAutoDefault() has no effect on submit. How can I make all of the buttons out of focus? Thank you.
1/3