Logo Search packages:      
Sourcecode: qps version File versions

int QtTableView::maxXOffset (  )  [protected]

Returns the maximum horizontal offset within the table of the view's left edge in table coordinates.

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

See also:
maxColOffset(), maxYOffset(), totalWidth()

Definition at line 2079 of file qttableview.C.

References cellWidth(), testTableFlags(), totalWidth(), and viewWidth().

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

{
    int tw = totalWidth();
    int maxOffs;
    if ( testTableFlags(Tbl_scrollLastHCell) ) {
      if ( nCols != 1)
          maxOffs =  tw - ( cellW ? cellW : cellWidth( nCols - 1 ) );
      else
          maxOffs = tw - viewWidth();
    } else {
      if ( testTableFlags(Tbl_snapToHGrid) ) {
          if ( cellW ) {
            maxOffs =  tw - (viewWidth()/cellW)*cellW;
          } else {
            int goal = tw - viewWidth();
            int pos = tw;
            int nextCol = nCols - 1;
            int nextCellWidth = cellWidth( nextCol );
            while( nextCol > 0 && pos > goal + nextCellWidth ) {
                pos -= nextCellWidth;
                nextCellWidth = cellWidth( --nextCol );
            }
            if ( goal + nextCellWidth == pos )
                maxOffs = goal;
             else if ( goal < pos )
               maxOffs = pos;
             else
               maxOffs = 0;
          }
      } else {
          maxOffs = tw - viewWidth();
      }
    }
    return maxOffs > 0 ? maxOffs : 0;
}


Generated by  Doxygen 1.6.0   Back to index