24

Is it possible to get all tabs widgets that where added by addTab(QWidget() in QTabWidget in a list.

We can use self.findChildren(QWidget), but it also returns all other widgets inside itself, and there is no way to filter them.

Mat
  • 202,337
  • 40
  • 393
  • 406
Qiao
  • 16,565
  • 29
  • 90
  • 117

1 Answers1

41

Read the documentation you pointed to more carefully :-)

QTabWidget has a QWidget *widget(int index) method that returns the tab at index index. Use that to get the tab widgets. That class also has a int count(); that tells you how many tabs there are.

With these two, you can iterate over all the tabs quite easily.

Mat
  • 202,337
  • 40
  • 393
  • 406