MCPcopy Create free account
hub / github.com/baldurk/renderdoc / Find

Method Find

qrenderdoc/Windows/EventBrowser.cpp:448–499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

446 }
447
448 QModelIndex Find(bool forward, QModelIndex eidStart)
449 {
450 if(m_FindResults.empty())
451 return QModelIndex();
452
453 // if we're already on a find result we can just zoom to the next one
454 int idx = m_FindResults.indexOf(eidStart);
455 if(idx >= 0)
456 {
457 if(forward)
458 idx++;
459 else
460 idx--;
461 if(idx < 0)
462 idx = m_FindResults.count() - 1;
463
464 idx %= m_FindResults.count();
465
466 return m_FindResults[idx];
467 }
468
469 // otherwise we need to do a more expensive search. Get the EID for the current, and find the
470 // next find result after that (wrapping around)
471 uint32_t eid = data(eidStart, ROLE_EFFECTIVE_EID).toUInt();
472
473 if(forward)
474 {
475 // find the first result >= our selected EID
476 for(int i = 0; i < m_FindResults.count(); i++)
477 {
478 uint32_t findEID = data(m_FindResults[i], ROLE_SELECTED_EID).toUInt();
479 if(findEID >= eid)
480 return m_FindResults[i];
481 }
482
483 // if we didn't find any, we're past all the results - return the first one to wrap
484 return m_FindResults[0];
485 }
486 else
487 {
488 // find the last result <= our selected EID
489 for(int i = m_FindResults.count() - 1; i >= 0; i--)
490 {
491 uint32_t findEID = data(m_FindResults[i], ROLE_SELECTED_EID).toUInt();
492 if(findEID <= eid)
493 return m_FindResults[i];
494 }
495
496 // if we didn't find any, we're before all the results - return the last one to wrap
497 return m_FindResults.back();
498 }
499 }
500
501 int NumFindResults() const { return m_FindResults.count(); }
502 bool FindEIDSearch() const { return m_FindEIDSearch; }

Callers 1

FindNextMethod · 0.45

Calls 6

QModelIndexClass · 0.50
dataFunction · 0.50
emptyMethod · 0.45
indexOfMethod · 0.45
countMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected