I have a tabbed widget and all tabs have the same layout so I want to move the widget when the user changes tabs. What would be the code for this. I have tried a few things but it always seems to be missing one thing. the following only worked once but not from the slot called when the current tab is changed: txDiag_1 is a custom widget taking the whole tab area tabList.at(i) is a reference to the tab inside the tabWidget and movingHlayout is a horizontal layout.
ui.txDiag_1->setParent(tabList.at(1));
movingHlayout->setParent(tabList.at(1));
movingHlayout->setSpacing(3);
movingHlayout->setMargin(3);
movingHlayout->setObjectName(QString::fromUtf8("movingHlayout"));
movingHlayout->addWidget(ui.txDiag_1);
tabList.at(1)->setLayout(movingHlayout);
I thought maybe I should remove the old widget first but I figured I could just destroy the old layout and create a new one each time but still it didnt work.