MCPcopy Create free account
hub / github.com/KDE/kdevelop / finish

Method finish

plugins/quickopen/quickopenplugin.cpp:836–855  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

834 model->setParent(dialog->widget());
835 }
836 void finish()
837 {
838 //Select the declaration that contains the cursor
839 if (cursorDecl.isValid() && dialog) {
840 auto it = std::find_if(items.constBegin(), items.constEnd(),
841 [this](const DUChainItem& item) { return item.m_item == cursorDecl; });
842 if (it != items.constEnd()) {
843 // Need to invoke the scrolling later. If we did it now, then it wouldn't have any effect,
844 // apparently because the widget internals aren't initialized yet properly (although we've
845 // already called 'widget->show()'.
846 auto list = dialog->widget()->ui.list;
847 const auto num = std::distance(items.constBegin(), it);
848 QTimer::singleShot(0, list, [list, num]() {
849 const auto index = list->model()->index(num, 0, {});
850 list->setCurrentIndex(index);
851 list->scrollTo(index, QAbstractItemView::PositionAtCenter);
852 });
853 }
854 }
855 }
856 QPointer<QuickOpenWidgetDialog> dialog;
857 IndexedDeclaration cursorDecl;
858 QVector<DUChainItem> items;

Callers 5

widgetShownMethod · 0.45
reparseAsQualifiedIdMethod · 0.45
parseMethod · 0.45

Calls 7

constBeginMethod · 0.80
constEndMethod · 0.80
setCurrentIndexMethod · 0.80
isValidMethod · 0.45
widgetMethod · 0.45
indexMethod · 0.45
modelMethod · 0.45

Tested by

no test coverage detected