Does ScrollPerPixel ever work?
-
So I have a QTreeWidget derived class that has big item height (200 pixels, for example). And I often have about 100 items in the view. I found even if I set the vertical scroll mode to ScrollPerPixel, it still scrolls too fast (or too "jumpy"). If I understand correctly, shouldn't ScrollPerPixel mean scroll pixel by pixel? I would expect the view scrolls smoothly like a static image. If I clicked on the up/down arrow buttons on the scroll bar, I expect the view to scroll up/down by one pixel. Instead, it scrolls about 180 pixels a time. How is the step size determined? Is there any way to set it to 1? I tried to obtain the vertical scrollbar and set the step size to 1, but it didn't work.
Any suggestions?
Thanks,
RP
-
No, I think you misunderstand what ScrollPerPixel means. It means that scrolling is not snapped to scroll only complete items at a time, but that you can scroll freely, meaning that only a single line of pixels might be drawn of the last or the first item.
You can adapt the step size if you want.
-
-
You might have to do that after a layout change, and both the constructor and the item adding is too early for that. You can test that by simply setting it with a timer a second after setting the data or something like that.
Best solution would be to dig through the sources of QTreeView and see where/when the step size is set, so you can re-set it afterwards, of course.