PDA

View Full Version : replace widget in Qsplitter



malaz
27th May 2015, 16:46
hi guys,

i have problem.. when i have 2 widgets(buttons) in the same splliter and i want to replace the first one with Tabwidget.. i lose the right stretch factor (1:1) it will be like (2:1) i use insertwidget(0,tab)



splitter->addwidget(qbut1);
splitter->addwidget(qbut2);
splitter->insertwidget(0,tab);

ChrisW67
27th May 2015, 22:50
If the intent is to switch back and forth between displaying a button or a table in the left pane then you would be better off putting those in a QStackedWidget and adding that as the first widget in the splitter.

If you stick with your current approach then you can remove the button widget by simply deleting the object. If you want to control the stretch factors then do so after you have added/removed.

malaz
29th May 2015, 13:45
the problem is even when i add at the first one tab and one button..tab takes size more than button
how can i make it (1:1) i try


splitter->setStretchFactor(0,1);
splitter->setStretchFactor(1,1);


but it doesn't work