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

Method previousHighlightIndex

kdevplatform/outputview/outputmodel.cpp:349–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347}
348
349QModelIndex OutputModel::previousHighlightIndex( const QModelIndex &currentIdx )
350{
351 Q_D(OutputModel);
352
353 //We have to ensure that startrow is >= rowCount - 1 to get a positive value from the % operation.
354 int startrow = rowCount() + (d->isValidIndex(currentIdx, rowCount()) ? currentIdx.row() : rowCount()) - 1;
355
356 if(!d->m_errorItems.empty())
357 {
358 qCDebug(OUTPUTVIEW) << "searching previous error";
359
360 // Jump to the previous error item
361 auto previous = d->m_errorItems.lower_bound( currentIdx.row() );
362
363 if( previous == d->m_errorItems.begin() )
364 previous = d->m_errorItems.end();
365
366 --previous;
367
368 return index( *previous, 0, QModelIndex() );
369 }
370
371 for ( int row = 0; row < rowCount(); ++row )
372 {
373 int currow = (startrow - row) % rowCount();
374 if( d->m_filteredItems.at( currow ).isActivatable )
375 {
376 return index( currow, 0, QModelIndex() );
377 }
378 }
379 return QModelIndex();
380}
381
382QModelIndex OutputModel::lastHighlightIndex()
383{

Callers 1

selectItemMethod · 0.80

Calls 8

isValidIndexMethod · 0.80
emptyMethod · 0.80
QModelIndexClass · 0.70
indexFunction · 0.50
rowMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected