MCPcopy Create free account
hub / github.com/BehaviorTree/Groot / refreshExpandedSubtrees

Method refreshExpandedSubtrees

bt_editor/mainwindow.cpp:1197–1234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1195}
1196
1197void MainWindow::refreshExpandedSubtrees()
1198{
1199 auto container = currentTabInfo();
1200 if( !container){
1201 return;
1202 }
1203 auto scene = container->scene();
1204 auto root_node = findRoot( *scene );
1205 if( !root_node )
1206 {
1207 return;
1208 }
1209
1210 std::vector<QtNodes::Node*> subtree_nodes;
1211 std::function<void(QtNodes::Node*)> selectRecursively;
1212
1213 selectRecursively = [&](QtNodes::Node* node)
1214 {
1215 auto subtree_model = dynamic_cast<SubtreeNodeModel*>(node->nodeDataModel());
1216 if(subtree_model && subtree_model->expanded())
1217 {
1218 subtree_nodes.push_back( node );
1219 }
1220 else{
1221 auto children = getChildren( scene, *node, false );
1222 for(auto child_node: children)
1223 {
1224 selectRecursively(child_node);
1225 }
1226 }
1227 };
1228 selectRecursively( root_node );
1229
1230 for (auto subtree_node: subtree_nodes)
1231 {
1232 subTreeExpand( *container, *subtree_node, SUBTREE_REFRESH );
1233 }
1234}
1235
1236void MainWindow::on_toolButtonLayout_clicked()
1237{

Callers

nothing calls this directly

Calls 4

findRootFunction · 0.85
getChildrenFunction · 0.85
sceneMethod · 0.80
expandedMethod · 0.80

Tested by

no test coverage detected