Adjust the parent size when child is hidden
I have the following dialog structure:
It's a splitter with frames where is each frame contain button and scroll area.
When the user uncheck the button the scroll area is hiding. And result is:
So the button just aligned on the center of frame.
But I want another behavior like on the following image:
If I understand correctly I just need call adjustSize() for the frame when I hide the scroller:
@void MainWindow::on_btn_1(bool b)
But unfortunately it's does not work :-(
"Link to the source code:":http://files.rsdn.ru/38394/QtTest2.zip
use QToolBox instead.
just ui->scrollArea->setVisible(b); should work
also remove frame, frame_2, frame_3 and use vertical layout on scrollArea_global. Add vertical spacer at bottom to handle case when all buttons are off.
PS: you don't have to add separate layout on widget. Just right click on control and select layout from there.
Thanks... but I need behavior (with the same set of controls) as I subscribed above.
I just simplify my real case in this example to show the behavior that I need to get.
I tried use the spacer but in this case splitter does not work.
sorry I previously missed qsplitter messing around ;-)
You could use something like this
@ui->frame->setMaximumHeight(b ? 99999 : ui->pushButton->height());@
@ui->frame->setMaximumHeight(b ? 99999 : 0);@
if you set frame's minimumSize
Thanks a lot!