| | 4455 | bool UIManagedTreeListType::jumpToRandom() |
| | 4456 | { |
| | 4457 | if (!current_node) |
| | 4458 | { |
| | 4459 | return false; |
| | 4460 | } |
| | 4461 | |
| | 4462 | // |
| | 4463 | // Move the active node to a random node in the list |
| | 4464 | // |
| | 4465 | |
| | 4466 | int position = random() % current_node->siblingCount(); |
| | 4467 | GenericTree *new_node = current_node->getParent()->getChildAt(position, visual_order); |
| | 4468 | |
| | 4469 | if (new_node) |
| | 4470 | { |
| | 4471 | current_node = new_node; |
| | 4472 | if (show_whole_tree) |
| | 4473 | { |
| | 4474 | for(int i = active_bin; i <= bins; i++) |
| | 4475 | { |
| | 4476 | emit requestUpdate(screen_corners[i]); |
| | 4477 | } |
| | 4478 | } |
| | 4479 | else |
| | 4480 | { |
| | 4481 | refresh(); |
| | 4482 | } |
| | 4483 | |
| | 4484 | emit nodeEntered(current_node->getInt(), current_node->getAttributes()); |
| | 4485 | current_node->becomeSelectedChild(); |
| | 4486 | return true; |
| | 4487 | } |
| | 4488 | return false; |
| | 4489 | } |
| | 4490 | |