QPushButton is in focus when QDialog is loaded



  • 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.





  • @VRonin
    Hi,
    I used

        Image_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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.