QTableView width and columns width
Hi! I have a QTableView placed into a horizontal layout in a QMainWindow. When the table is empty (I mean no model is set yet) the user can resize the main window (and therefore the table) down to a very small size.
After setting the model, two odd things happen:
- the QMainWindow resize itself to accomodate the columns
- the user cannot shrink the window below the whole width of the column.
Both behaviors are unwanted in my application. I need to maintain the current window's size and let the user to change its dimensions how he likes. Of course if the width of the table is less than the whole width of the columns I expect to use scrollbars.
Which property you recommend to look for?
You can try and modify the QSizePolicy of your QTableView
The QSizePolicy is set to Expanding, because I want the table should take all the space by default. Anyway I tried to set it to Minimum but nothing changes. It seems something force the minimum size of the table, but I printed out the actual minimumSize value and is set to 0, even after adding the contents.