2
votes

I have a QTreeWidget in my application that is populated by a user selection elsewhere. The contents of the first column of treewidget is other custom qt widgets based on the users selection. These widgets can vary in size dramatically, but when I scroll through the tree widget, it always keeps a top level item in the tree at the top of the visible window. When the widget at that top level item is bigger than the scrolling area, it means that it is impossible to see everything that is there.

I have tried putting the treewidget in a qscrollarea, but I get the same problem. Is there any way to change the scrolling policy so that it scrolls based on the total size of the treewidget, rather than the positioning of the top level items?

Many thanks

1

1 Answers

1
votes

I figured it out. I had to change the verticalScrollMode to ScrollPerPixel. For anyone else that hits this, it's as simple as:

treeWidget->setVerticalScrollMode(QTreeView::ScrollPerPixel)

Easy when you know how, hard to find when you dont...