How to link a QPushButton to a tab of QTabWidget?

假如想象 提交于 2021-01-29 04:43:32

问题


I am using Qt to do a GUI program, so my problem is, I have made a homepage in my GUI program and I have some 4 tabs tab1,tab2,tab3,tab4 and I have made QPushbutton over at homepage. So can anyone tell me how can I link QPushButton to tab3 of QTabWidget so that when I click the button it should take me to tab 3. Thank you


回答1:


First create a slot, what handles the buttons click event (Slots, QPushButton) Then use the QTabWidgets setCurrentIndex function like yourTabWidget->setCurrentIndex(2);



来源:https://stackoverflow.com/questions/11867016/how-to-link-a-qpushbutton-to-a-tab-of-qtabwidget

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