UE4 TreeView expansion is not complete (expand all) solution (blueprint)

The blogger himself found that only the items of the root node can be expanded when using the tree list expansion, and then looked for related solutions.

I checked the internal and external networks and found that most of the solutions are C++. Here I share a blueprint solution I thought of for reference. If there are any mistakes, please forgive me.

The reason why the expansion is incomplete is that the child nodes cannot be obtained through GetListItems, and expandall essentially obtains all items and then loops to set their expansion.

My solution is to expand the state without using

 Add children directly to the tree list.

The specific implementation is as follows:

The use of this function is controlled by a bool variable whether it is expanded or not.

 

 Then synchronize the bool variable in the construction sub-item, and add it directly to the treeview if it is expanded. This is equivalent to not using the method of generating subitems by itself, but also generating subitems at the same time. The final presentation is fully unfolded.

But this has a disadvantage, that is, it cannot be folded. But the blogger does not need to fold the expanded state itself. After switching the state, the list is refreshed and the sub-items are generated again according to the general method.

Guess you like

Origin blog.csdn.net/WindRushNight/article/details/125552517