Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How do you tab into the fields of a tab box if the tab box is dynamically generated?



  • I currently have a form with some Line Edit fields and a tab box below. This tab box is populated with three selectable tabs that each have their own unique line edit fields. I would like to be able to tab from the main form's line edit fields into the line edit fields of whatever tab is currently being displayed.

    I cannot just set the tab order through QT Designer because the tab box is dynamically generated.

    Any help would be appreciated.

    Thanks!


  • Qt Champions 2019

    Just take a look at the generated code for the ui file and you will find QWidget::setTabOrder()



  • Ok, I see in the generated code that setTabOrder() is called for each widget in the form.

    Can I still use the .ui file and overwrite the tabbing behaviour using setTabOrder() or does this mean that I have to impliment the form without a .ui file?


  • Lifetime Qt Champion

    @psigil
    Hi
    Using an UI file is 100% the same as using plain code.
    The UI files is converted to C++ code which is run in
    setupUI() function
    so after that function you can just change it with setTabOrder
    all you wish.


Log in to reply