How to reference a widget inside a specific tab of a QTabWidget?

倾然丶 夕夏残阳落幕 提交于 2019-12-23 23:45:46

问题


I am using PyQt to make a GUI for a circuit simulator, and am programmatically creating and deleting tabs (i.e. the user clicks on a button, and a new tab is added to a QTabWidget).

This is already working (I drew a QFrame in Qt Creator and, in my code, add it as a new tab), but I need to refer to a widget which is inside a specific tab (e.g. a QwtPlot inside the 3rd tab). How can this be achieved?


回答1:


You can retrieve the widget from a specific tab by calling QTabWidget.widget(index).



来源:https://stackoverflow.com/questions/9449708/how-to-reference-a-widget-inside-a-specific-tab-of-a-qtabwidget

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!