Stacked and TabWidget
-
Hi, Im new to development and I have installed -QT- Qt Creator on Ubuntu. Now I have started a app that maybe sometime in the futre can be run on AmigaOS4.
The thing is: I have a toolbar in the upper mainWindow that contains 14 buttons. And under the toolbar I have a stackedWidget with 14 pages, and in that stack I have 1 tabWidget on each page.
How do i do to make each button in the toolbar refer to the right tabWidget that is in the stackedWidget?
-
The way forward lies with "Signals and Slots":http://doc.qt.nokia.com/stable/signalsandslots.html
Assuming you're making use of a QStackedWidget, I would personally have assigned the buttons to a QButtonGroup and then all your requirements can basically be met by a single line of code:
@connect(myButtonGroup, SIGNAL(buttonClicked(int), myStackWidget, SLOT(setCurrentIndex(int)))@
(obviously you'll just have to ensure that your indices correspond)
-
[quote author="Andre" date="1315470086"]Sounds like you are building some home brewn nested tab structure. In UI terms, even without seeing it, that is probably not a good idea. Try to see if you can think up a different solution for your UI that is less complicated to use. [/quote]
I thought that was a simple beginner thing.