View Full Version : Need help with scrollarea scrolling out of control

24th November 2012, 02:50
I have made a small program that will scroll an area but it wont scroll right, it WILL in fact scroll but it keeps on scrolling no matter what i do, i can slide the vertical scroll bar back upwards and it will continue to scroll the contents of my box until i cant see them anymore.
here is code

void MainWindow::on_verticalScrollBar_sliderMoved(int position)
ui->verticalScrollBar->setRange(0, 1000);
ui->scrollArea->scroll(0, 1);

can anyone tell me how to stop the scrolling at a point and then scroll back upwards.

24th November 2012, 06:04
You are telling Qt to scroll down 1 pixel no matter which direction the scroll bar is being moved. Perhaps you should consider setting the range once, then testing position against its bounds and scrolling accordingly.

25th November 2012, 03:06
how would i go about doing that? I don't understand how to test it against its bounds. Sorry but im VERY new to all this, just started about 3 days ago.