简体   繁体   中英

How to connect event when tab widget is selected?

I am using PyQt5 to make the user interface. Now I have set up a tab widget, and I want to trigger the event at such a time when a specific tab is selected. In other words, for example, I have tab A and tab B, and I want to execute the function every time user is switching from tab A to tab B.

When a new tab is selected currentChanged(int index) signal of the QTabWidget is emitted. Just connect that signal to some slot and check the index of the newly selected tab which is passed as argument.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM