PDA

View Full Version : QWebFrame scroll down to the max.



bunjee
28th August 2009, 01:14
Hey there,

Here is a trick one.

I'm doing the following on a QWebFrame:


QWebView::page()->mainFrame()->
evaluateJavaScript(QString("var ni = document.getElementById('%1');"
"ni.innerHTML = '%2';").
arg(QString::number((int) chunk)).
arg(chunk->html()));

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

Then I want to scroll my mainFrame to the max :


int max = webBox->page()->mainFrame()->scrollBarMaximum(Qt::Vertical);

webBox->page()->mainFrame()->setScrollBarValue(Qt::Vertical, max);

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.

bunjee
28th August 2009, 22:55
webBox->page()->mainFrame()->
evaluateJavaScript("window.scrollTo(0, 1000000);");