How to incrementally add children to QTreeWidget
I have a QtreeWidget , that viewport shows and it has 10 root nodes
I have a incrementally add the children , means if I have 10 roots nodes
and When I expand A root nodes ,
- How to calculate how many children I can see, in current display
- Also add only those many children which the user can see
- When we move the vertical scrollbar or resize then we only add incrementally children which are not added
Can someone give the hint
JonB last edited by
I will just say: in order to see which items are visible, https://stackoverflow.com/questions/28829192/how-to-get-the-number-of-items-of-a-qtreewidget answers claim that
QTreeWidgetItem::isExpanded()will tell you that for each item. Frankly I'm dubious, as I would have thought that would only tell you about expansion not visibility, but you could test. I do not see anything in
QTreeWidgetItemto tell you about size/visibility (they are not
QWidgets, unfortunately), so that's problematic.
maybe you will get a better answer from an expert....
What's the reason not adding the items at all on startup trying some crude stuff instead?
Then you should not use a convenience widget but a proper model with a QTreeView ...
that is not possible because of legacy code
On the one side you say you're adding items by yourself to the QTreeWidget and want to modify this behavior in really strange ways, on the other side you tell us that you can't replace exactly the QTreeWidget with a QTreeView and build a proper model ...