[SOLVED]QtabWidget, how to make it scrollable
-
Hi,
I'm sorry if I created a duplicate thread but I couldn't find anything on this thread in search so I'm posting this question.
I created a Tab widget using QT Designer and I want to make the contents in the tab area to be scrollable so my form will not be too long. Appreciate it if someone can help to advise on it.
Thank you -
You don't make the tab widget scrollable, but instead you add a widget on the tab that provides the scrolling. Simply place a QScrollArea widget as your only widget on the tab, and place your form elements on that widget.
Better yet: design your forms in such a way that no scrolling is needed :)
-
ermm, i tried just that but it still doesn't show?
-
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? -
yes, the scrollbar policy is set to Qt::ScrollBarAsNeeded. I changed it to Qt::ScrollBarAlwaysOn but it's not scrollable :(
-
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 -
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?
-
Ok I understand. Thank Andre!