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

Method getItem

plugins/quickopen/quickopenmodel.cpp:380–422  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

378}
379
380QuickOpenDataPointer QuickOpenModel::getItem(int row, bool noReset) const
381{
382 ///@todo mix all the models alphabetically here. For now, they are simply ordered.
383 ///@todo Deal with unexpected item-counts, like for example in the case of overloaded function-declarations
384
385#ifdef QUICKOPEN_USE_ITEM_CACHING
386 const auto dataIt = m_cachedData.constFind(row);
387 if (dataIt != m_cachedData.constEnd()) {
388 return *dataIt;
389 }
390#endif
391 int rowOffset = 0;
392
393 Q_ASSERT(row < rowCount(QModelIndex()));
394
395 for (const ProviderEntry& provider : m_providers) {
396 if (!provider.enabled) {
397 continue;
398 }
399 uint itemCount = provider.provider->itemCount();
400 if (( uint )row < itemCount) {
401 QuickOpenDataPointer item = provider.provider->data(row);
402
403 if (!noReset && provider.provider->itemCount() != itemCount) {
404 qCDebug(PLUGIN_QUICKOPEN) << "item-count in provider has changed, resetting model";
405 m_resetTimer->start();
406 m_resetBehindRow = rowOffset + row; //Don't reset everything, only everything behind this position
407 }
408
409#ifdef QUICKOPEN_USE_ITEM_CACHING
410 m_cachedData[row + rowOffset] = item;
411#endif
412 return item;
413 } else {
414 row -= provider.provider->itemCount();
415 rowOffset += provider.provider->itemCount();
416 }
417 }
418
419// qWarning() << "No item for row " << row;
420
421 return QuickOpenDataPointer();
422}
423
424QSet<IndexedString> QuickOpenModel::fileSet() const
425{

Callers

nothing calls this directly

Calls 6

constEndMethod · 0.80
QModelIndexClass · 0.50
constFindMethod · 0.45
itemCountMethod · 0.45
dataMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected