| 347 | } |
| 348 | |
| 349 | QModelIndex OutputModel::previousHighlightIndex( const QModelIndex ¤tIdx ) |
| 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 | |
| 382 | QModelIndex OutputModel::lastHighlightIndex() |
| 383 | { |
no test coverage detected