| 2125 | */ |
| 2126 | |
| 2127 | int QtTableView::maxYOffset() |
| 2128 | { |
| 2129 | int th = totalHeight(); |
| 2130 | int maxOffs; |
| 2131 | if ( testTableFlags(Tbl_scrollLastVCell) ) { |
| 2132 | if ( nRows != 1) |
| 2133 | maxOffs = th - ( cellH ? cellH : cellHeight( nRows - 1 ) ); |
| 2134 | else |
| 2135 | maxOffs = th - viewHeight(); |
| 2136 | } else { |
| 2137 | if ( testTableFlags(Tbl_snapToVGrid) ) { |
| 2138 | if ( cellH ) { |
| 2139 | maxOffs = th - (viewHeight()/cellH)*cellH; |
| 2140 | } else { |
| 2141 | int goal = th - viewHeight(); |
| 2142 | int pos = th; |
| 2143 | int nextRow = nRows - 1; |
| 2144 | int nextCellHeight = cellHeight( nextRow ); |
| 2145 | while( nextRow > 0 && pos > goal + nextCellHeight ) { |
| 2146 | pos -= nextCellHeight; |
| 2147 | nextCellHeight = cellHeight( --nextRow ); |
| 2148 | } |
| 2149 | if ( goal + nextCellHeight == pos ) |
| 2150 | maxOffs = goal; |
| 2151 | else if ( goal < pos ) |
| 2152 | maxOffs = pos; |
| 2153 | else |
| 2154 | maxOffs = 0; |
| 2155 | } |
| 2156 | } else { |
| 2157 | maxOffs = th - viewHeight(); |
| 2158 | } |
| 2159 | } |
| 2160 | return maxOffs > 0 ? maxOffs : 0; |
| 2161 | } |
| 2162 | |
| 2163 | |
| 2164 | /*! |
nothing calls this directly
no outgoing calls
no test coverage detected