PDA

View Full Version : QTableView Vertical Scrollbar



tvj4218
12th September 2017, 19:10
Hello all.

I'm using a QTableView within a QWidget window.
The table shows up fine but it does not have a vertical scroll bar so
the bottom part of it gets cut off.

How do I enable the vertical scroll bar?

I'm using 5.7.

Thank you.

N

Gokulnathvc
13th September 2017, 05:53
Have you tried this??
setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); or You can try with QTableWidget instead.

d_stranz
13th September 2017, 17:47
I'm using a QTableView within a QWidget window.

Have you put this table view inside of a layout on your widget? If you have simply placed it on the widget without the layout, then there is nothing to manage its size and it won't get the information needed to automatically display the scroll bars when it is sized to be smaller than its contents.

The "solution" suggested by Gokulnathvc won't actually work if the table view is not in a layout. Yes, the scrollbar will always be visible, but the bottom of the table will still be cut off.