After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 598739 - TreeViewColumn incorrectly resizes itself with sizing mode of AUTOSIZE and TreeStore model?
TreeViewColumn incorrectly resizes itself with sizing mode of AUTOSIZE and Tr...
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
2.16.x
Other Windows
: Normal normal
: ---
Assigned To: gtktreeview-bugs
gtktreeview-bugs
: 355314 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-10-17 00:33 UTC by Patrick
Modified: 2018-02-10 03:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screenshot. (4.83 KB, image/png)
2009-10-17 00:33 UTC, Patrick
Details
Example. (6.65 KB, text/x-csrc)
2009-10-17 00:34 UTC, Patrick
Details

Description Patrick 2009-10-17 00:33:21 UTC
Created attachment 145643 [details]
Screenshot.

I noticed that if you have a tree view with a column in it (with a text
renderer in the column) that has its sizing mode set to AUTOSIZE, you use a
tree store as the tree view's model, and then:

1) Create a top-level row with a semi-long string in it, but not long enough to
cause the tree view column to increase its own width.

2) Create a child row of that top-level row with a shorter string in it.

... then even if the child row's string is shorter than the parent row's
string, the tree view column will increase its width.

Is this intended? I kind of get why this might be happening but still this
functionality seems counterintuitive to me.

Attached is a screenshot as well as an example in C.
Comment 1 Patrick 2009-10-17 00:34:10 UTC
Created attachment 145644 [details]
Example.
Comment 2 Kristian Rietveld 2009-11-01 15:30:14 UTC
*** Bug 355314 has been marked as a duplicate of this bug. ***
Comment 3 Kristian Rietveld 2009-11-01 15:31:38 UTC
(In reply to comment #0)
> Is this intended? I kind of get why this might be happening but still this
> functionality seems counterintuitive to me.

Not really.  But you are the first one that managed to correctly and briefly describe it and create a small stand-alone test case.  Will be looking into this.
Comment 4 Kristian Rietveld 2009-11-01 16:17:03 UTC
Okay, this is not at all trivial to fix.  The main culprit here is that requested size is kept for each cell, the requested size for a column is the sum of these for the cells.  So we have

[indent][image_size][text_size           ]

if we add another row as child, shorter string:

[indent    ][image_size][text_size]

then tree view will re-use the size of the cell according to the first string, because that is larger.  The column size becomes: indent + requested image_size + requested text_size.  image_size and text_size are the same as in the first row, but indent increases, resulting in:

[indent][image_size][text_size           ]
[indent    ][image_size][text_size           ]


If I recall correctly, the per-cell size maintenance was also hurting something else.  I can't remember what exactly right now.  It is clear that when we address the cell sizing/layouting that this has to be addressed as well.
Comment 5 Matthias Clasen 2018-02-10 03:29:47 UTC
We're moving to gitlab! As part of this move, we are closing bugs that haven't seen activity in more than 5 years. If this issue is still imporant to you and
still relevant with GTK+ 3.22 or master, please consider creating a gitlab issue
for it.