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
Asked
Active
Viewed 1,023 times
1 Answers
2
First create a slot, what handles the buttons click event (Slots, QPushButton)
Then use the QTabWidgets setCurrentIndex function like yourTabWidget->setCurrentIndex(2);

Balázs Édes
- 13,452
- 6
- 54
- 89
-
It is a little bit nice to use `setCurrentWidget()` instead of `setCurrentIndex()` so you don't have to pass some random number but instead the actual tab widget to show. – scai Aug 08 '12 at 14:55
-
Can you please edit your and provide me code of it to understand? I am very new to Qt. – Varun Chitre Aug 08 '12 at 15:41
-
You are wellcome! If you want to create Gui applications, keep using Qt. If you get used to C++, the functionality what both the Gui and Core part offers, is really good. – Balázs Édes Aug 08 '12 at 17:02