Results 1 to 5 of 5

Thread: Autoscroll QTextBrowser

  1. #1
    Join Date
    Mar 2007
    Posts
    15
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Autoscroll QTextBrowser

    Hi,

    I'm making this chat window and I implemented the chat board with a QTextBrowser. I'm new to Qt so if there's a better way to do it please say so.

    What I want to do, is to make the textBrowser scroll down when there's no space left for new messages. Right now if I send like 50 messages to the board, the scrollbar appears but it doesn't scroll down and I can't see the rest of the messages unless I scroll manually which is not user friendly.

    So is there anyway to make the QTextBrowser scroll down automatically each time text is inserted? Or maybe I should use another widget that can do that?

    Many thanks

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

    Default Re: Autoscroll QTextBrowser

    Please search the forum. A simmilar issue was brought up not more than two weeks ago.

  3. #3
    Join Date
    Mar 2007
    Posts
    15
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Autoscroll QTextBrowser

    I did and found nothing, I'll keep searching then

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

  5. The following user says thank you to wysota for this useful post:

    aLiNuSh (24th March 2007)

  6. #5
    Join Date
    Mar 2007
    Posts
    15
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Autoscroll QTextBrowser

    Thanks for the link
    I've solved it now

    Here's how...

    Qt Code:
    1. void MainChatDlg::on_send_pushButton_clicked ()
    2. {
    3. if (!message_lineEdit->text().isEmpty ())
    4. {
    5. conversation_textBrowser->insertPlainText('\n' + message_lineEdit->text ());
    6. QScrollBar *sb = conversation_textBrowser->verticalScrollBar();
    7. sb->setValue(sb->maximum());
    8. message_lineEdit->clear ();
    9. }
    10. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. How to display images in QTextBrowser ?
    By probine in forum Qt Programming
    Replies: 1
    Last Post: 12th January 2007, 08:58
  2. CSS in QTextBrowser
    By gesslar in forum Qt Programming
    Replies: 1
    Last Post: 4th April 2006, 09:17
  3. [QT4] QtextBrowser and image size (win)
    By sebgui in forum Qt Programming
    Replies: 0
    Last Post: 28th March 2006, 21:01
  4. Replies: 2
    Last Post: 15th March 2006, 12:13
  5. how to adjust sizes of QTextBrowser?
    By Pan Wojtas in forum Qt Programming
    Replies: 2
    Last Post: 7th February 2006, 22:25

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.