I am experimenting with a program to log the work needed on a car and. I have created a stacked layout, with group boxes for each layout. I want to connect a button in a group box to make it change to another layout. I don't understand linking to children and parents properly so I can't get it to work.
I want to connect the addCar button signal 'clicked()' in carSelectionPage to the stacked layout slot 'setCurrentIndex(1)'. Where do I put the connect code and how do I refer to both items?
Alternatively if there is a better way of having separate windows which I can navigate between, that would be good.
Qt Code:
#include <QtGui> #include "cardiary.h" #include <QStackedLayout> { stackedLayout->addWidget(carSelectionPage()); stackedLayout->addWidget(addCarPage()); mainLayout->addLayout(stackedLayout); setLayout(mainLayout); stackedLayout->setCurrentIndex(0); } { carList->addWidget(car1); carList->addWidget(addCar); groupBox->setLayout(carList); return groupBox; } { layout->addWidget(carNameLabel); layout->addWidget(carNameInput); groupBox->setLayout(layout); return groupBox; }To copy to clipboard, switch view to plain text mode
Bookmarks