02-11-2013 01:13 PM
Who could help me with a code webview + ActivityIndicator. When loading the page, I leave the indicator, but is removed when the page loads 100%.
I have that but it does not disappear when loading pa facebook page
02-11-2013 05:39 PM - edited 02-11-2013 05:44 PM
Lets see some of your code!
You should be connecting to the webviews loadProgressChanged SLOT similar to this:
connect(m_WebContent, SIGNAL(loadProgressChanged ( int )), this, SLOT(updateProgress ( int )));
In updateProgress you would do something like this:
void YourClass::updateProgress ( int loadProgress )
{
if(loadProgress > 99.9f) {
//loading is done, don't need the SLOT anymore. disconnect(m_WebContent, SIGNAL(loadProgressChanged ( int )), this, SLOT(updateProgress ( int )));
//Loading is done, set the activity indicator to invisible. m_WebProgressIndicator->setVisible(false); }
//Update the indicator. m_WebProgressIndicator->setValue((int)loadProgress);
}
I'm using a progress indicator, so you would not need to update the value at any point except when loading is finished, if you are using an ActivityIndicator instead.
If you're using QML here's a code sample.
You would do:
onLoadingChanged: {
if (loadRequest.status == WebLoadStatus.Succeeded) {
qDebug() << "Load finished.";
idOfActivityIndicator.setVisible(false);
}
}