PDA

View Full Version : How to scroll the content and set the scroll's range in the QListWidget?



tszzp
28th December 2009, 13:24
I met two problems in the QListWidget:
1) How to scroll the content in the QListWidget? I find the scroll function is scroll the QListWidget,not the scroll the content. try the scrollContentsBy(0, dy) and viewport()->scroll(dx, dy), find them work incorrect. when I search it in the network, it is said there is a bug in the scrollContentsBy function. when I use the verticalScrollBar()->setValue( y ) function, find it can work. but it will cause the second problem. the second problem as below.
How to scroll the content in the QListWidget. My Qt version is 4.5.3 in windows platform.

2) if use the verticalScrollBar()->setValue(y) to scroll the content, I find the scrollbar's range is very small, so I want to change the range. but I find when I use verticalScrollBar()->setRange(0, 1000 ) in a function, when I get the range in the other function, it will return the old range, not the range 0-1000. so the verticalScrollBar()->setRange(0, 1000 ) isn't work. Can you tell me how to solve it? thanks.