Reputation: 358
Very quick question here. I was wondering if it is possible for me to reference individual tabs from a QTabWidget by number. This will save me a lot of time, as I am generating an unknown number of tabs during run-time. I could not find anything in the QT documentation, but I feel like this is a very basic feature that should be included. I am thinking something like this (not real code just an idea, I realize tabNumber() doesn't exist):
ui->tabArea->tabNumber(12);
If there isn't a public function, perhaps there's some other way? Please don't suggest referencing tabs by name because that is out of the question (potentially 100's of tabs), and I have already tried it.
Upvotes: 0
Views: 350
Reputation: 25165
If you want the tab with a certain index, use widget():
QWidget* tab = tabWidget->widget( index );
Upvotes: 2
Reputation: 5661
I think the setCurrentIndex()
method is what you are looking for.
Upvotes: 0