[PyKDE] positioning the vertical Scrollbar in a TextEdit box

dougb at bellz.org dougb at bellz.org
Tue Feb 13 11:14:59 GMT 2007


Tony Cappellini wrote:
> When I add text to a TextEdit box, the vertical scrollbar appears, and
> the slider is at the bottom of the text.
> 
> I want to move the slider to the top of the text, but the Slider
> attributes of the Scrollbar are not available from within the TexEdit
> widget. At least I don't see how to access them.
> 
> What is the preferred way to reposition the scrollbar slider to the
> beginning of the text?

You don't specify Qt3 or Qt4?

Under Qt3, QTextEdit inherits from QScrollView, which has a
setContentsPos(int x, int y) member.  So:

   myTextEdit.setContentsPos(0, 0)

should work.


Under Qt4, QTextEdit inherits from QAbstractScrollArea, which has a
verticalScrollBar() member, that returns a QScrollBar.  So:

   myTextEdit.verticalScrollBar().setValue(0)

should work.

Doug.




More information about the PyQt mailing list