[Qt-interest] How to scroll QTextEdit to the end

yogesh upreti yogesh.upreti at gmail.com
Tue Jun 22 00:05:18 CEST 2010


Hi Nikos,
How do I use triggerAction signal from QAbstractSlider with a TextEdit?

Regds
Yogesh


------------------------------
>
> Message: 6
> Date: Mon, 21 Jun 2010 08:14:41 +0200
> From: Andre Somers <andre at familiesomers.nl>
> Subject: Re: [Qt-interest] How to scroll QTextEdit to the end
> To: qt-interest at trolltech.com
> Message-ID: <4C1F0351.6080905 at familiesomers.nl>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Op 21-6-2010 0:53, Nikos Chantziaras schreef:
> > On 06/21/2010 01:21 AM, yogesh upreti wrote:
> >
> >> Hallo Group,
> >> I have a QTextEdit Widget in my gui, which I use to display the log of
> >> work being performed by my programme.
> >> How do I make it sure that in this text edit (which is read only),
> >> whenever I insert a text, it should scroll to the bottom.
> >> I use this code in textChanged() signal of MyTextEdit. But this somehow
> >> doesn't work.
> >>
> >> QScrollBar *hbar = ui->MyTextEdit->horizontalScrollBar();
> >> hbar->setValue(hbar->maximum());
> >>
> >> Is this piece of code correct???
> >>
> > Try QAbstractSlider::triggerAction(QAbstractSlider::SliderToMaximum).
> >
> Perhaps you should only do this if the slider was not moved manually in
> the meantime, and the cursor position is at the end (or something like
> that). Otherwise, users won't be able to scroll comfortably and take a
> little bit of time to read the log messages. It is *very* annoying if
> you try to read a log, and it keeps scrolling away to the end because a
> new message has been added...
>
> Andr?
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100622/e83dc2bb/attachment.html 


More information about the Qt-interest-old mailing list