Important: Please read the Qt Code of Conduct -

Tab order stuck inside qtextedit

  • Hi,

    I have a form which consists of several qlineedits followed by a qtextedit and finally 2 buttons (submit, cancel). The problem is the tab order gets stuck inside the qtextedit and doesn't move to the buttons when the tab button is clicked. Instead, the tab(s) are entered into the qtextedit.

    How to get around this to allow tab clicks to reach the buttons?

  • Use the tabChangesFocus property. The default value is false.
    Simply change it using QTextEdit::setTabChangesFocus(true).

  • @Joel-Bodenmann

    I designed the app using Qt designer. Where would be the best location to cal the setTabChangesFocus function?

  • Sorry, I can't help with that. I don't use the designer. One of the reasons why I don't use the designer is exactly that: Half the stuff you need to do in code anyway - at least it was like this the last time I used :)
    Note: That is purely my personal, subjective opinion. There are more than enough people around here who love using the designer. I'm sure someone one of those people will be happy to answer your question.

  • Lifetime Qt Champion


    IIRC, that's a property so you should be able to set it in the property panel of the widget in designer.

    Otherwise you can do it in the constructor of your custom widget.

Log in to reply