| 446 | } |
| 447 | |
| 448 | void OutputWidget::activateIndex(const QModelIndex &index, QAbstractItemView *view, KDevelop::IOutputViewModel *iface) |
| 449 | { |
| 450 | if( ! index.isValid() ) |
| 451 | return; |
| 452 | QModelIndex sourceIndex = index; |
| 453 | QModelIndex viewIndex = index; |
| 454 | const auto fvIt = constFindFilteredView(view); |
| 455 | if (fvIt != m_views.cend() && fvIt->proxyModel) { |
| 456 | auto proxy = fvIt->proxyModel; |
| 457 | if ( index.model() == proxy ) { |
| 458 | // index is from the proxy, map it to the source |
| 459 | sourceIndex = proxy->mapToSource(index); |
| 460 | } else if (proxy == view->model()) { |
| 461 | // index is from the source, map it to the proxy |
| 462 | viewIndex = proxy->mapFromSource(index); |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | view->setCurrentIndex( viewIndex ); |
| 467 | view->scrollTo( viewIndex ); |
| 468 | |
| 469 | if( m_activateOnSelect->isChecked() ) { |
| 470 | iface->activate( sourceIndex ); |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | void OutputWidget::selectFirstItem() |
| 475 | { |
nothing calls this directly
no test coverage detected