[Qt 5.2] Improving QWebView performance with large amount of data?
-
I am using QWebView to display a large amount of, continuously growing data. Using QWebElement::appendInside to add more data to the page as needed.Nothing fancy to the HTML, no javascript or images just some basic CSS. I have disabled javscript using QWebSettings. About 600k lines would be the be highest possible total, although generally its only at 50k.
I could be adding up to 100 lines every 200 msec. I batch the HTML I want to add to the page together in a single QString before calling QWebElement::appendInside, but it's still slow. Even after I stop updating the page, when I have a large amount of data in it lags to scroll through it or atleast maxes out the thread.
I'm not particularly tied to using WebKit if someone can suggest a totally different but faster way of displaying the data.
@const int numRecords = _RecordsQueue.size() - 1;
QWebElement element = ui.LogText->page()->mainFrame()->documentElement().findFirst("body");
QString html;
html.reserve(325 * (numRecords + 1));
for(int i=0; i<=numRecords; i++)
{
const QString msg = _ToString->ToString(_RecordsQueue.at(i), _CurrentEncounterID);
if (!msg.isEmpty())
{
html.append("<p>" % msg % "<p>");
}
}
_RecordsQueue.clear();if (!html.isEmpty())
{
html.squeeze();
element.appendInside(html);if (!_ScrollTimer->isActive())
{
_ScrollTimer->start();
}
}@