Qt-interest Archive, December 2007
QTextBrowser and Scrolling area
Message 1 in thread
Good afternoon.
I would like to know if there is a way, when I call setHtml(QString s) on a
QTextBrowser, to avoid that the scrollbars scroll to the beginning.
Moreover, is there a simple way to make them always scroll to the end
(text browser is read-only)
Thanks a lot
Giacomo.
--
[ signature omitted ]
Message 2 in thread
On Dec 4, 2007, at 11:38 AM, Giacomo wrote:
> I would like to know if there is a way, when I call setHtml(QString
> s) on a
> QTextBrowser, to avoid that the scrollbars scroll to the beginning.
>
> Moreover, is there a simple way to make them always scroll to the end
> (text browser is read-only)
Use QTextEdit::ensureCursorVisible after you've moved the cursor to
the end of the document.
Brad
--
[ signature omitted ]
Message 3 in thread
Thanks.
And to avoid any scrolling when setHtml() is called?
2007/12/4, Brad Howes <howes@xxxxxxxxxx>:
>
> On Dec 4, 2007, at 11:38 AM, Giacomo wrote:
>
> I would like to know if there is a way, when I call setHtml(QString s) on a
> QTextBrowser, to avoid that the scrollbars scroll to the beginning.
>
> Moreover, is there a simple way to make them always scroll to the end
> (text browser is read-only)
>
> Use QTextEdit::ensureCursorVisible after you've moved the cursor to the end
> of the document.
>
> Brad
>
>
> --
> Brad Howes
> Group 42
> MIT Lincoln Laboratory • 244 Wood St. • Lexington, MA 02173
> Phone: 781.981.5292 • Fax: 781.981.3495 • Secretary: 781.981.7420
>
>
>
>
>
--
[ signature omitted ]
Message 4 in thread
On Dec 5, 2007, at 3:02 AM, Giacomo wrote:
> And to avoid any scrolling when setHtml() is called?
int vPos = doc->verticalScrollBar()->value();
int hPos = doc->horizontalScrollBar()->value();
doc->setHTML( content );
gui_->log_->verticalScrollBar()->setValue( vPos );
gui_->log_->horizontalScrollBar()->setValue( hPos );
Does that work?
Brad
--
[ signature omitted ]
Message 5 in thread
On Dec 5, 2007, at 12:40 PM, Brad Howes wrote:
> int vPos = doc->verticalScrollBar()->value();
> int hPos = doc->horizontalScrollBar()->value();
> doc->setHTML( content );
> gui_->log_->verticalScrollBar()->setValue( vPos );
> gui_->log_->horizontalScrollBar()->setValue( hPos );
Ack! Cut-and-paste error:
int vPos = doc->verticalScrollBar()->value();
int hPos = doc->horizontalScrollBar()->value();
doc->setHTML( content );
doc->verticalScrollBar()->setValue( vPos );
doc->horizontalScrollBar()->setValue( hPos );
--
[ signature omitted ]