开发者

Get all tabs widgets in QTabWidget

开发者 https://www.devze.com 2023-03-08 21:12 出处:网络
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 th

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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消