I noticed that the horizontal scroll bar in my treeView didn’t seem to be reflecting the width of my open items properly. I’m using a custom component for my TreeViewItem, but I think this would still be a bug even if I wasn’t. It has to do with the way the indentation is calculated.
Here’s how I fixed it in the TreeViewItem::updatePositions function (please forgive that I’m transcribing it by hand cuz my source is on a different machine):
if (isOpen()) {
//const int ourIndent = getIndentX(); // removed by me
newY += totalHeight;
totalWidth += getIndentX(); // added by me
for (int i=0; i<subItems.size(); ++i) {
TreeViewItem *const ti = subItems.getUnchecked(i);
ti->updatePositions(newY);
newY += ti->totalHeight;
totalHeight += ti->totalHeight;
//totalWidth = jmax(totalWidth, ti->totalWidth + ourIndent); // removed by me
totalWidth = jmax(totalWidth, ti->totalWidth); // added by me
}
}