There is no way to get the tab order as an integer.
If you look into the C++ code that the uic tool creates from your ui file, it will call QWidget::setTabOrder()
a few times, and that method just takes two QWidget
pointers. Thus, Qt internally doesn't even store the tab order as an integer, but rather as a chained list of QWidget
pointers.
You can query that chained list with QWidget::nextInFocusChain()
and QWidget::previousInFocusChain()
. This gives you the whole focus chain of the widget, containing all child widgets inside it, in the right order. Then you can get the real tab order list by checking their focusPolicy, enabled state and visible state, just like the inside implementation of the QWidget::focusNextPrevChild()
function. If you really need an integer index here, you need to devise an algorithm yourself that calculates indices from that obtained tab order list.