void MarkListTable::select( int i ) { if ( i < 0 || i >= (signed) items.count() || i == sel ) return ; MarkListTableItem *it = items.at( i ); if ( sel != -1 ) { items.at( sel )->setSelect( FALSE ); updateCell( sel, 0 ); updateCell( sel, 1 ); //updateCell( sel, 2 ); } it->setSelect( TRUE ); sel = i; updateCell( i, 0 ); updateCell( i, 1 ); //updateCell( i, 2 ); emit selected( i ); emit selected( it->text() ); if ( ( i<=0 || rowIsVisible( i-1 ) ) && ( i>= (signed) items.count()-1 || rowIsVisible( i+1 ) ) ) return; setTopCell( QMAX( 0, i - viewHeight()/cellHeight()/2 ) ); }
void KDirListBox::keyPressEvent( QKeyEvent *e ) { int index = 0; switch ( e->key() ) { case Key_Return: // fall through case Key_Enter: index = currentItem(); if ( index == -1 ) return; if ( isDir( index ) ) select( index ); break; case Key_Home: highlightItem( 0 ); setTopCell( 0 ); // somehow highlightItem() does NOT scroll!? break; case Key_End: index = QListBox::count() -1; if ( index >= 0 ) { highlightItem( index ); // somehow highlightItem() does NOT scroll!? setBottomItem( index ); } break; default: QListBox::keyPressEvent( e ); } }
void DiffView::setCenterOffset(int offset) { if (!rowIsVisible(offset)) { int visiblerows = viewHeight()/cellHeight(0); setTopCell( qMax(0, offset - visiblerows/2) ); } }
void KFinderWin::setBranchVisible( KFinderItem* startItem ) { KFinderItem* curItem; int i1 = -1, i2 = -1; int branchLevel = -1; bool bFound = false; QListIterator<KFinderItem> it( itemList ); //for ( ; it.current(); ++it ) for ( curItem = finder->first(); curItem != 0; curItem = finder->next() ) { if( bFound ){ i2++; if( curItem->getLevel() <= branchLevel ) break; } else { i1++; if( curItem == startItem ) { branchLevel = curItem->getLevel(); i2 = i1; bFound = true; } } } int lastRow = lastRowVisible(); if( (i2 - i1) > lastRow - topCell() - 2 ) setTopCell( i1 ? (i1 - 1) : i1 ); else if( i2 > lastRow ) { int newTopCell = topCell() + ( i2 - lastRow ); if( findRow(minViewY() + cellHeight() - 1) != topCell()) newTopCell++; setTopCell( newTopCell ); } else if( i1 < topCell() ) { int newTopCell = topCell() - ( topCell() - i1 ); if( newTopCell ) newTopCell--; setTopCell( newTopCell ); } }
void TableBody::timerEvent(QTimerEvent *) { // timer not proved ! return; // printf("timer\n"); if (!autoscrolling) return; ////killTimers(); if (scrolldir == UP) { int top = topCell(); setTopCell((top > 1) ? top - 1 : 0); dragSelectTo(topCell()); } else { setTopCell(topCell() + 1); int bottom = lastRowVisible(); dragSelectTo((bottom < numRows()) ? bottom : numRows() - 1); } startTimer(scroll_delay); }
void KUserTable::clear() { setTopCell(0); current = -1; setNumRows(0); updateScrollBars(); }
//?? void TableBody::showRange(int from, int to) { int h = viewHeight() / cellHeight(); if (to >= topCell() + h) setTopCell(qMax(0, qMin(from, to - h + 1))); }
/// !!!! void TableBody::centerVertically(int row) { int topcell = row - viewHeight() / (cellHeight() * 2); setTopCell(qMax(topcell, 0)); update(); }