| 2079 | */ |
| 2080 | |
| 2081 | int QtTableView::maxXOffset() |
| 2082 | { |
| 2083 | int tw = totalWidth(); |
| 2084 | int maxOffs; |
| 2085 | if ( testTableFlags(Tbl_scrollLastHCell) ) { |
| 2086 | if ( nCols != 1) |
| 2087 | maxOffs = tw - ( cellW ? cellW : cellWidth( nCols - 1 ) ); |
| 2088 | else |
| 2089 | maxOffs = tw - viewWidth(); |
| 2090 | } else { |
| 2091 | if ( testTableFlags(Tbl_snapToHGrid) ) { |
| 2092 | if ( cellW ) { |
| 2093 | maxOffs = tw - (viewWidth()/cellW)*cellW; |
| 2094 | } else { |
| 2095 | int goal = tw - viewWidth(); |
| 2096 | int pos = tw; |
| 2097 | int nextCol = nCols - 1; |
| 2098 | int nextCellWidth = cellWidth( nextCol ); |
| 2099 | while( nextCol > 0 && pos > goal + nextCellWidth ) { |
| 2100 | pos -= nextCellWidth; |
| 2101 | nextCellWidth = cellWidth( --nextCol ); |
| 2102 | } |
| 2103 | if ( goal + nextCellWidth == pos ) |
| 2104 | maxOffs = goal; |
| 2105 | else if ( goal < pos ) |
| 2106 | maxOffs = pos; |
| 2107 | else |
| 2108 | maxOffs = 0; |
| 2109 | } |
| 2110 | } else { |
| 2111 | maxOffs = tw - viewWidth(); |
| 2112 | } |
| 2113 | } |
| 2114 | return maxOffs > 0 ? maxOffs : 0; |
| 2115 | } |
| 2116 | |
| 2117 | |
| 2118 | /*! |
nothing calls this directly
no outgoing calls
no test coverage detected