Logo Search packages:      
Sourcecode: qps version File versions

int QtTableView::maxYOffset (  )  [protected]

Returns the maximum vertical offset within the table of the view's top edge in table coordinates.

This is used mainly to set the vertical scroll bar's range.

See also:
maxRowOffset(), maxXOffset(), totalHeight()

Definition at line 2125 of file qttableview.C.

References cellHeight(), testTableFlags(), totalHeight(), and viewHeight().

Referenced by clearTableFlags(), maxRowOffset(), resizeEvent(), setOffset(), setTopLeftCell(), and updateScrollBars().

{
    int th = totalHeight();
    int maxOffs;
    if ( testTableFlags(Tbl_scrollLastVCell) ) {
      if ( nRows != 1)
          maxOffs =  th - ( cellH ? cellH : cellHeight( nRows - 1 ) );
      else
          maxOffs = th - viewHeight();
    } else {
      if ( testTableFlags(Tbl_snapToVGrid) ) {
          if ( cellH ) {
            maxOffs =  th - (viewHeight()/cellH)*cellH;
          } else {
            int goal = th - viewHeight();
            int pos = th;
            int nextRow = nRows - 1;
            int nextCellHeight = cellHeight( nextRow );
            while( nextRow > 0 && pos > goal + nextCellHeight ) {
                pos -= nextCellHeight;
                nextCellHeight = cellHeight( --nextRow );
            }
            if ( goal + nextCellHeight == pos )
                maxOffs = goal;
             else if ( goal < pos )
               maxOffs = pos;
             else
               maxOffs = 0;
          }
      } else {
          maxOffs = th - viewHeight();
      }
    }
    return maxOffs > 0 ? maxOffs : 0;
}


Generated by  Doxygen 1.6.0   Back to index