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

Method index

kdevplatform/language/codecompletion/codecompletionmodel.cpp:376–398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

374}
375
376QModelIndex CodeCompletionModel::index(int row, int column, const QModelIndex& parent) const
377{
378 if (parent.isValid()) {
379 auto* element = static_cast<CompletionTreeElement*>(parent.internalPointer());
380
381 CompletionTreeNode* node = element->asNode();
382
383 if (!node) {
384 qCDebug(LANGUAGE) << "Requested sub-index of leaf node";
385 return QModelIndex();
386 }
387
388 if (row < 0 || row >= node->children.count() || column < 0 || column >= ColumnCount)
389 return QModelIndex();
390
391 return createIndex(row, column, node->children[row].data());
392 } else {
393 if (row < 0 || row >= m_completionItems.count() || column < 0 || column >= ColumnCount)
394 return QModelIndex();
395
396 return createIndex(row, column, const_cast<CompletionTreeElement*>(m_completionItems[row].data()));
397 }
398}
399
400QModelIndex CodeCompletionModel::parent(const QModelIndex& index) const
401{

Callers 4

templateIndexesMethod · 0.45
descriptionExtractionMethod · 0.45
itemDataMethod · 0.45
initMethod · 0.45

Calls 6

createIndexFunction · 0.85
asNodeMethod · 0.80
QModelIndexClass · 0.70
isValidMethod · 0.45
countMethod · 0.45
dataMethod · 0.45

Tested by 3

descriptionExtractionMethod · 0.36
itemDataMethod · 0.36
initMethod · 0.36