[SOLVED]QtabWidget, how to make it scrollable
-
ermm, i tried just that but it still doesn't show?
-
Without showing us what you did, it is hard for us to see what you did wrong...
-
sorry, but here's a snapshot i took.
http://i57.tinypic.com/14ncz2p.png
as you can see on the right, there are some widgets under the Scrollarea. I just kinda position the widgets under it and try to run it.
Am i missing something else? -
Try putting everyting in proper layouts.
-
Looks like scrollbars policy is Qt::ScrollBarAlwaysOff (if container of your widgets is is QScrollArea).It should be Qt::ScrollBarAsNeeded (default) or Qt::ScrollBarAlwaysOn , so then you'll get desired result.
-
yes, the scrollbar policy is set to Qt::ScrollBarAsNeeded. I changed it to Qt::ScrollBarAlwaysOn but it's not scrollable :(
-
strange, looks like controls parent isn't QScrollArea.
Have you tried same thing on QMainWindow (add QScrollArea + child controls) ? -
Hi,
I tested with just adding QScrollArea and child controls on the QMainWindow but the scrollbar doesn't appear too when it's being run. :O -
Then I really don't know what's up.
-
Andre has a good suggestion.
-
Thanks guys, it was because of the layout problem. Btw, everytime i click "Layout in a Form layout" the scroll area automatically resizes to a small box on the top left corner. Is there a way to prevent this?
-
Apply a layout at every level, including on the widget that contains the QScrollArea... Everywhere you see the Layout-with-a-red-crossed-circle icon in the Object Inspector should be looked at.
-
If you use layouts, you have to use layouts all the way:
- Every widget (except the top level one) has to be in a layout
- Every widget that contains other widgets has to have a layout.
Recursively.
-
Ok I understand. Thank Andre!