| 47 | }; |
| 48 | |
| 49 | void selectUse(ContextBrowserView* view, Direction direction) |
| 50 | { |
| 51 | auto abstractNaviWidget = qobject_cast<AbstractNavigationWidget*>(view->navigationWidget()); |
| 52 | |
| 53 | if (!abstractNaviWidget) { |
| 54 | return; |
| 55 | } |
| 56 | |
| 57 | auto usesWidget = qobject_cast<UsesWidget*>(abstractNaviWidget->context()->widget()); |
| 58 | if (!usesWidget) { |
| 59 | return; |
| 60 | } |
| 61 | |
| 62 | OneUseWidget* first = nullptr, * previous = nullptr, * current = nullptr; |
| 63 | const auto& usesWidgetItems = usesWidget->items(); |
| 64 | for (auto item : usesWidgetItems) { |
| 65 | auto topContext = qobject_cast<TopContextUsesWidget*>(item); |
| 66 | if (!topContext) { |
| 67 | continue; |
| 68 | } |
| 69 | const auto& topContextItems = topContext->items(); |
| 70 | for (auto item : topContextItems) { |
| 71 | auto navigationList = qobject_cast<NavigatableWidgetList*>(item); |
| 72 | if (!navigationList) { |
| 73 | continue; |
| 74 | } |
| 75 | const auto& navigationListItems = navigationList->items(); |
| 76 | for (auto item : navigationListItems) { |
| 77 | auto use = qobject_cast<OneUseWidget*>(item); |
| 78 | if (!use) { |
| 79 | continue; |
| 80 | } |
| 81 | if (!first) { |
| 82 | first = use; |
| 83 | } |
| 84 | current = use; |
| 85 | if (direction == PreviousUse && current->isHighlighted() && previous) { |
| 86 | previous->setHighlighted(true); |
| 87 | previous->activateLink(); |
| 88 | current->setHighlighted(false); |
| 89 | return; |
| 90 | } |
| 91 | if (direction == NextUse && previous && previous->isHighlighted()) { |
| 92 | current->setHighlighted(true); |
| 93 | current->activateLink(); |
| 94 | previous->setHighlighted(false); |
| 95 | return; |
| 96 | } |
| 97 | previous = current; |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | if (direction == NextUse && first) { |
| 103 | first->setHighlighted(true); |
| 104 | first->activateLink(); |
| 105 | if (current && current->isHighlighted()) |
| 106 | current->setHighlighted(false); |
no test coverage detected