void ResultStoreBase::insertResultItemIfValid(int index, ResultItem &resultItem) { if (resultItem.isValid()) { m_results[index] = resultItem; syncResultCount(); } else { filteredResults += resultItem.count(); } }
int ResultStoreBase::insertResultItem(int index, ResultItem &resultItem) { int storeIndex; if (m_filterMode && index != -1 && index > insertIndex) { pendingResults[index] = resultItem; storeIndex = index; } else { storeIndex = updateInsertIndex(index, resultItem.count()); insertResultItemIfValid(storeIndex - filteredResults, resultItem); } syncPendingResults(); return storeIndex; }