qtqwidgetqt-designertab-ordering

How to set tab order with promoted widgets?


I have the following design

QWidget
  QFrame promoted to FooComponent 
    QLineEdit a (internal tab order 1)
    QLineEdit b (tab order 2)
  QLineEdit c (tab order 1)

In Qt Creator (designer) I can not set a tab order for the FooComponent. So when I activate the QWidget I see the cursor in c, but I would want it to be in a.

How can I handle tab order with cascaded components?


Solution

  • You can do this with setFocuProxy. In FooComponent, set the focus-proxy to the first child widget in its internal tab-order.

    Then in Qt Designer, change the focusPolicy of the promoted QFrame to TabFocus, and reset the tab-order so that it is in the right place in the sequence.