Results 1 to 3 of 3

Thread: qtextbrowser stop scrolling on append

  1. #1
    Join Date
    Oct 2006
    Location
    Hawaii
    Posts
    130
    Thanks
    48
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default qtextbrowser stop scrolling on append

    Hi, I notice that there are a few of posts related to making a qtextbrowser scroll, but I can't seem to exactly find what I am looking for.

    What I have is a qtextbrowser that I append data to. This works fine, but when I append data, the qtextbrowser auto-scrolls to the bottom.

    Is it possible to have the qtextbrowser not scroll when data is appended to it, and only when the user scrolls it themselves?

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qtextbrowser stop scrolling on append

    The text browser automatically adjusts its scrollbars, so there is little or nothing you can do about this.

    You can try(might cause flicker):
    Qt Code:
    1. //add content to text browser
    2. textBrowser->horizontalScrollBar()->setValue(0);
    3. textBrowser->verticalScrollBar()->setValue(0);
    To copy to clipboard, switch view to plain text mode 
    Basically this just readjusts the scrollbars' positions to 0.

  3. The following user says thank you to marcel for this useful post:

    tpf80 (16th September 2007)

  4. #3
    Join Date
    Oct 2006
    Location
    Hawaii
    Posts
    130
    Thanks
    48
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qtextbrowser stop scrolling on append

    Qt Code:
    1. textBrowser->verticalScrollBar()->setValue(0);
    To copy to clipboard, switch view to plain text mode 
    Works well for what I need. Since a user wouldn't be scrolling the widget while data is being appended, I can append all the data that is needed, then force it to the top using the hint you provided me. It actually happens so fast that It appears to be scrolled to the top from the get-go with no flicker.

    Thanks again

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.