columnWidth glitch
-
If I call QTablewidget::columnWidth in my constructor before showing the dialog, then my hidden columns will have 0 width when I unhide them during runtime.
When I simply leave out the columnWidth call they will show with correct size.
It doesn't matter if columnWidth was called before or after initially hiding the column. (I thought it might have been set to 0 because of it being hidden). The width before hiding is 150.
Do you think this is worth a ticket?
-
Hi,
Technically, trying to get the size of any GUI component in its constructor doesn't make sense as they have no "physical" representation.
That said, why are you trying to retrieve the width of columns you are hiding ?
-
No I am retrieving the width of columns after they get shown in order to fix a bug where they end up with 0 width despite the use of minimum section size:
setColumnHidden(col, vis); if (vis && isVisible() && columnWidth(col) <= horizontalHeader()->minimumSectionSize()) { setColumnWidth(col, horizontalHeader()->minimumSectionSize()); }
Probably another bug for the bug tracker unless you know the reason for this to happen.
My assumption is that this has to do with restoring window states. -
Can you provide a minimal compilable example that shows that behaviour ?
-
I don't think that you will get a section size smaller than the minimum section size with 5.11 and higher... :)
-
Because of https://bugreports.qt.io/browse/QTBUG-64173
-
If you find issues with 5.11 please provide a minimal, compilable example so we can fix it.
-
After reviewing it I am even more confused.
My initial statement suggests that simply the call caused the behaviour:
When I simply leave out the columnWidth call they will show with correct size. It doesn't matter if columnWidth was called before or after initially hiding the column.
But I can't reproduce it anymore and I get the feeling that I missed a detail.
My current tests indicate that I might have actually changed the width of hidden items by mistake a some point.
That width turns out to be zero.So my latest fix is to simply ignore hidden items regarding any columnWidth call.
I'll mark this topic as resolved for now.
Although I am still certain that the behaviour happened like I said at some point at least. (simply added a columnWidth(col); somewhere)
If I ever manage to find it again I will let you know.