Results 1 to 8 of 8

Thread: QTextEdit + auto scroll

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2006
    Location
    Argentina - CABA
    Posts
    66
    Qt products
    Platforms
    Unix/X11
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: QTextEdit + auto scroll

    Quote Originally Posted by wysota View Post
    Probably the simplest way is to call QTextEdit::ensureCursorVisible() after adding some text to the text edit. In case you don't have a cursor (for example when the widget is read only), you might try this combination instead:
    Qt Code:
    1. QTextEdit *edit; // assuming this is your text edit
    2. QScrollBar *sb = edit->verticalScrollBar();
    3. sb->setValue(sb->maximum());
    To copy to clipboard, switch view to plain text mode 

    This should scroll the widget to the bottom...
    Hi!

    I' have a same behaviour with QTextEdit (which contain html text). It has chat functions. I load a GUI inside my code, which allready has a QTextEdit and a alwaysOn vertical scrollbar.
    How I could autoscroll it to the end?

    Thanks.

    Cheers.
    Gustavo A. DÃ*az
    artistic.gdnet.com.ar

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QTextEdit + auto scroll

    Move the cursor to the end.

  3. #3
    Join Date
    Mar 2006
    Location
    Argentina - CABA
    Posts
    66
    Qt products
    Platforms
    Unix/X11
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: QTextEdit + auto scroll

    You mean with this example above?

    pTextEdit->insertPlainText(strText);
    QTextCursor c = pTextEdit->textCursor();
    c.movePosition(QTextCursor::End);
    pTextEdit->setTextCursor(c);
    Cause i did this (with PyQt) and din't worked...

    Cheers.
    Gustavo A. DÃ*az
    artistic.gdnet.com.ar

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QTextEdit + auto scroll

    Did you call ensureCursorVisible?

Similar Threads

  1. QTextEdit, sizeHint, QWidget
    By TheKedge in forum Qt Programming
    Replies: 1
    Last Post: 3rd February 2007, 09:25
  2. QScrollArea's Scroll Bars
    By ToddAtWSU in forum Qt Programming
    Replies: 5
    Last Post: 19th September 2006, 14:27
  3. QTextEdit API questions (plain text)
    By Gaspar in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 07:03
  4. Retrieving offsets of scroll in QWorkspace
    By hardgeus in forum Qt Programming
    Replies: 6
    Last Post: 9th May 2006, 03:25
  5. [QT 4] QTextEdit performance
    By fellobo in forum Qt Programming
    Replies: 8
    Last Post: 6th March 2006, 20:27

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.