问题
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