QScrollBar Snap to value

Posted by j3frea on Stack Overflow See other posts from Stack Overflow or by j3frea
Published on 2010-03-08T14:31:58Z Indexed on 2010/03/08 14:36 UTC
Read the original article Hit count: 310

Filed under:
|

Hi all,

I'm wanting to implement a scroll bar that snaps to particular values (like windows can snap to the edge of a screen). The idea is that as I drag the scrollbar down it snaps the bar to values as it approaches them.

My scenario is displaying 3 chapters of text. I would like to be able to snap to the beginning or end of a chapter. Of course, to go to the start of the first chapter the scrollbar one can just scroll to the top and likewise with the end of the third chapter. So I'd like to draw two lines on the scrollbar to represent the start of the second and third chapters and then have the top and bottom of the scrollbar snap to those lines. So I'm really actually wanting to use this within a QTextBrowser but I can control a QTextBrowser with a "QSnapScrollBar" I just don't really know where to start.

Any help would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about qt

Related posts about scrollbar