[Qt-interest] How to scroll QTextEdit to the end
Nikos Chantziaras
realnc at arcor.de
Tue Jun 22 00:23:48 CEST 2010
It's not a signal. It's a member function. You call it with the
QAbstractSlider::SliderAction (enum) you want:
hbar->triggerAction(QAbstractSlider::SliderToMaximum);
http://doc.trolltech.com/4.6/qabstractslider.html#triggerAction
http://doc.trolltech.com/4.6/qabstractslider.html#SliderAction-enum
On 06/22/2010 01:05 AM, yogesh upreti wrote:
> 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
> <mailto:andre at familiesomers.nl>>
> Subject: Re: [Qt-interest] How to scroll QTextEdit to the end
> To: qt-interest at trolltech.com <mailto:qt-interest at trolltech.com>
> Message-ID: <4C1F0351.6080905 at familiesomers.nl
> <mailto: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?
>
>
>
More information about the Qt-interest-old
mailing list