| 549 | } |
| 550 | |
| 551 | void TopContextUsesWidget::setExpanded(bool expanded) |
| 552 | { |
| 553 | if (!expanded) { |
| 554 | m_toggleButton->setText(QLatin1String(" <a href='toggleCollapsed'>[") + |
| 555 | i18nc("Refers to opening a UI element", "Expand") + QLatin1String("]</a>")); |
| 556 | deleteItems(); |
| 557 | } else { |
| 558 | m_toggleButton->setText(QLatin1String(" <a href='toggleCollapsed'>[") + |
| 559 | i18nc("Refers to closing a UI element", "Collapse") + QLatin1String("]</a>")); |
| 560 | if (hasItems()) |
| 561 | return; |
| 562 | DUChainReadLocker lock(DUChain::lock()); |
| 563 | TopDUContext* topContext = m_topContext.data(); |
| 564 | |
| 565 | if (topContext && m_declaration.data()) { |
| 566 | CodeRepresentation::Ptr code = createCodeRepresentation(topContext->url()); |
| 567 | setUpdatesEnabled(false); |
| 568 | |
| 569 | IndexedTopDUContext localTopContext(topContext); |
| 570 | for (const IndexedDeclaration& decl : std::as_const(m_allDeclarations)) { |
| 571 | if (decl.indexedTopContext() == localTopContext) { |
| 572 | addItem(new DeclarationWidget(*code, decl)); |
| 573 | } |
| 574 | } |
| 575 | |
| 576 | const auto contextUseWidgets = buildContextUses(*code, m_allDeclarations, topContext); |
| 577 | for (ContextUsesWidget* usesWidget : contextUseWidgets) { |
| 578 | addItem(usesWidget); |
| 579 | } |
| 580 | |
| 581 | setUpdatesEnabled(true); |
| 582 | } |
| 583 | } |
| 584 | } |
| 585 | |
| 586 | void TopContextUsesWidget::labelClicked() |
| 587 | { |
no test coverage detected