[Qt-interest] Autoscrolling--yet friendly--QTextEdit
Andre Somers
andre at familiesomers.nl
Fri Dec 10 07:26:34 CET 2010
Op 10-12-2010 1:27, Sherif Ghali schreef:
> Hello,
>
> I would like a QTextEdit instance to behave as follows. As long as the user has
> not touched the scroll wheel to read what has scrolled out of the widget,
> QTextEdit would auto-scroll to show the last line, but QTextEdit would not
> wrestle against the user by insisting to move the cursor to the bottom even
> while the user is trying to read something that scrolled out of the screen.
>
> Here is my attempt at a solution. As long as the guard “user_has_scrolled” is
> not true, MyQTextEdit scrolls to QTextCursor::End. Once the guard is true,
> auto-scroll is disabled.
>
> This doesn’t work. Why? Can you suggest a solution?
You may want to be more specific than "doesn't work". What did you
expect to happen? What happened instead? What did you try to fix that
already?
I think your way of doing this is incomplete. First, there are more ways
the user may attempt to scroll the text-edit, such as by moving the
cursor, or by manipulating the scrollbar. Those should trigger the same
effect, I think. On the other hand, you want the user to be able resume
the auto-scroll. Perhaps when you manually scroll all the way to the
end? Or you set a corner widget to manually en- and disable it?
André
André
More information about the Qt-interest-old
mailing list