horizontalHeaderMinimumSectionSize not respected for last column in QTableView - actual value use seems greater than property value
-
Hi,
I have an issue with horizontalHeaderMinimumSectionSize not being respected for last column in QTableView. When I change the property it applies to all other columns, preventing the user from reducing with below a limit. But for the last column the actual limit used seems to be greater than what I set the property to. For example if I set horizontalHeaderMinimumSectionSize to 5 then the actual minimum size for the last columns seems to be ~50 but it's 5 for all other columns. This is an issue in my application because the last columns needs to be very small and just show a small icon.
Ideas?
-
Please provide some code and even better a minimal compilable example. Are you sure you don't have enabled
setStretchLastSection
? -
One more question - what Qt version and OS do you use?
-
Example:
https://www.udokaelectronics.com/files/LastTableSectionMinimumSizeExample.zip
The behavior I'm looking for is that the user shall be able to reduce the size of the last column by using the mouse cursor in the header. Put the cursor on the line between the two columns and drag to the right. Now it's just moved to the right if the user does that.
-
@olowo726 said in horizontalHeaderMinimumSectionSize not respected for last column in QTableView - actual value use seems greater than property value:
Now it's just moved to the right if the user does that.
For me all looks fine. The minimum size of 5 px is respected. Clicking between section 1 and 2 resizes section 1, Clicking between section 2 and the emty spaces section 2 is resized.
-
@Christian-Ehrlicher I think that the desired behavior is that if you click between section 1 and 2 and drags to the left then the minimum size is respected for section 1 (it is now) and if you drag to the right the minimum size of section 2 shall be respected (it isn't, this is what I would like it to be). Clicking between section 2 and empty space and dragging to the left the minimum size is respected.
-
Clicking between section 1 and 2 does not change the size of section 2 at all - at least not in your example.
-
Why?
Resizing a section can only be done with the spacer after the section - what's wrong with this? I don't see another behavior e.g. in Windows explorer or Excel or LibreOffice calc...