QTabWidgets , ways to find a tab.
-
wrote on 8 Oct 2015, 21:59 last edited by A Former User
Hi community !
I m currently dealing with Tabs
And I can't find a way to get the index of a tab by passing the name of this tab.I have 2 solutions :
1 - either I can get the index of the created tab at the creation step and then store it but no idea how to do that. or at least auto select the last created tab ? so from that i can get the index via currentIndex().
EDIT :
I can set the created tab by using QTabWidget.setCurentWidget(QWidget)2 - get the index based on the tab name ? Is that possible ?
Thx !
-
Hi,
You can use a loop and check the name of tab X where X is the for loop variable using the QTabBar of your QTabWidget.
Hope it helps
-
wrote on 9 Oct 2015, 00:58 last edited by
Hmm I thought about that but I wanted to avoid 'useless' iterations. What I have done is when i create my tab, I call the setCurrentWidget() and then I can get the Index with currentIndex().
3/3