PDA

View Full Version : Resizing QTableView inside a QTabWidget



Aslan
29th May 2010, 11:55
I am using a QTableView to display results from an SQlite database. The QTableView is placed into the QTabWidget using the graphical editor in QtCreator. Layout is done using a grid.
When I resize the main window, the QTabWidget will adjust its size but the QTableView inside will not. Both widgets use the "Expanding" size policy.

However, when I place my QTableView directly on the main window using grid layout, resizing of the main window works fine, the tableview adjusts its size automagically.
I seem to be missing some detail here. Can anyone please help how to get the qtableview resize automatically within the QTabWidget?

alexisdm
29th May 2010, 13:51
Widgets outside layouts aren't resized automatically by their parent widget.
You have to set a layout (it doesn't matter which type) inside each tab of the QTabWidget too.

Aslan
29th May 2010, 14:50
Widgets outside layouts aren't resized automatically by their parent widget.
You have to set a layout (it doesn't matter which type) inside each tab of the QTabWidget too.

Thanks!!:), this was the missing piece. I selected each tab and, using the context menu, set the layout to horizontal.. Now it works as expected.