Tab order does not work in Qt
-
Hello Qt experts
I really need a help on below issue in Qt.I have a class say, MainWidget which has HeadWidget and TabWidget.
In Qt designer, the component is headWidget of type HeadWidget. The tab order here works fine. It should go from all the components in the HeadWidget (it is set using setTabOrder) to TabWidget.
I wanted to add qml HeadWidget when a Boolean is true so I did following changes. (If bool is true => show new Qml HeadView else show default Qt View)
- In designer, changed headWidget is type QWidget.
- Instantiated in the constructor as follows
const auto layout = new QVBoxLayout(mUi->headWidget); mUi->headWidget->setLayout(layout); if (showQtView) { mHeadView = new HeadView(this); layout->addWidget(mHeadView); } else { showQmlView() }
Now, tab order is not working as expected. After the last element in the HeadWidget, it does not go to TabView in the MainWidget.
I tried explicitly setTabOrder => does not work
setFocusProxy does not work
and it has setFocusPolicy also set.Could someone guide me a way to fix this issue
-
Please provide a minimal, compilable example of your problem. No designer stuff needed to reproduce this issue.