MCPcopy Create free account
hub / github.com/NetHack/NetHack / doAutoScrollBars

Method doAutoScrollBars

outdated/win/Qt3/qt3tableview.cpp:1893–1943  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1891
1892
1893void QtTableView::doAutoScrollBars()
1894{
1895 int viewW = width() - frameWidth() - minViewX();
1896 int viewH = height() - frameWidth() - minViewY();
1897 bool vScrollOn = testTableFlags(Tbl_vScrollBar);
1898 bool hScrollOn = testTableFlags(Tbl_hScrollBar);
1899 int w = 0;
1900 int h = 0;
1901 int i;
1902
1903 if ( testTableFlags(Tbl_autoHScrollBar) ) {
1904 if ( cellW ) {
1905 w = cellW*nCols;
1906 } else {
1907 i = 0;
1908 while ( i < nCols && w <= viewW )
1909 w += cellWidth( i++ );
1910 }
1911 if ( w > viewW )
1912 hScrollOn = TRUE;
1913 else
1914 hScrollOn = FALSE;
1915 }
1916
1917 if ( testTableFlags(Tbl_autoVScrollBar) ) {
1918 if ( cellH ) {
1919 h = cellH*nRows;
1920 } else {
1921 i = 0;
1922 while ( i < nRows && h <= viewH )
1923 h += cellHeight( i++ );
1924 }
1925
1926 if ( h > viewH )
1927 vScrollOn = TRUE;
1928 else
1929 vScrollOn = FALSE;
1930 }
1931
1932 if ( testTableFlags(Tbl_autoHScrollBar) && vScrollOn && !hScrollOn )
1933 if ( w > viewW - VSBEXT )
1934 hScrollOn = TRUE;
1935
1936 if ( testTableFlags(Tbl_autoVScrollBar) && hScrollOn && !vScrollOn )
1937 if ( h > viewH - HSBEXT )
1938 vScrollOn = TRUE;
1939
1940 setHorScrollBar( hScrollOn, FALSE );
1941 setVerScrollBar( vScrollOn, FALSE );
1942 updateFrameSize();
1943}
1944
1945
1946/*!

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected