Results 1 to 2 of 2

Thread: QWebFrame scroll down to the max.

  1. #1
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default QWebFrame scroll down to the max.

    Hey there,

    Here is a trick one.

    I'm doing the following on a QWebFrame:

    Qt Code:
    1. QWebView::page()->mainFrame()->
    2. evaluateJavaScript(QString("var ni = document.getElementById('%1');"
    3. "ni.innerHTML = '%2';").
    4. arg(QString::number((int) chunk)).
    5. arg(chunk->html()));
    To copy to clipboard, switch view to plain text mode 

    The above is a javascript command that modifes an element's html content.

    Then I want to scroll my mainFrame to the max :

    Qt Code:
    1. int max = webBox->page()->mainFrame()->scrollBarMaximum(Qt::Vertical);
    2.  
    3. webBox->page()->mainFrame()->setScrollBarValue(Qt::Vertical, max);
    To copy to clipboard, switch view to plain text mode 

    Unfortunately the javascript is not evaluated in time, so I get wrong scrollbar values.

    Is it possible to be notified when the javascript is REALLY evaluated ?

    Is it possible forcing the scrollbar to stay down ?

    Thanks.

  2. #2
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: QWebFrame scroll down to the max.

    Qt Code:
    1. webBox->page()->mainFrame()->
    2. evaluateJavaScript("window.scrollTo(0, 1000000);");
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 1
    Last Post: 11th June 2009, 05:49
  2. Custom Scroll Widget Sizing Problem
    By sepehr in forum Qt Programming
    Replies: 2
    Last Post: 28th November 2008, 11:42
  3. ListWidget horizontal scroll.
    By patrick772goh in forum Qt Tools
    Replies: 3
    Last Post: 17th July 2007, 07:32
  4. QScrollArea's Scroll Bars
    By ToddAtWSU in forum Qt Programming
    Replies: 5
    Last Post: 19th September 2006, 13:27
  5. Retrieving offsets of scroll in QWorkspace
    By hardgeus in forum Qt Programming
    Replies: 6
    Last Post: 9th May 2006, 02: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.