I have a problem with showing multiple tables(without their own scrollbars) under one scrollbar. Is there any workaround or a good way to resolve this issue in Qt?
Asked
Active
Viewed 189 times
1 Answers
1
I've tried to do what you ask, and found this. So, here is a solution:
- add
QScrollArea
to a form - set the property
widgetResizable
to true - put
QWidget
to scroll area - right click on widget -> Set ancestor -> [your scroll area]
- add vertical layout to a widget
- scroll area will collapse, epand it with a mouse
- insert into the widget as many tables as you want
- set vertical size policy for each table to
Minimum
and set minimal vertical size.
Here is how it looks:
-
Hi there! Thanks for the answer. However, can i set each table height equals to it's content? I want to get off the scroll from each table. – Maksym Bulhakov Jan 03 '17 at 08:03
-
For each table get `verticalHeaderDefaultSize`, multiply it to number of rows and add few pixels, then set minimal vertical size. Also, set property `verticalScrollPolicy` to `ScrollBarAlwaysOff`. – Jan 03 '17 at 09:13