Reputation: 1179
I receive a HTML page in a thread (not the main thread). I would like to use the HTML parsing that's provided with QWebElement, but for that I need QWebPage. Since QWebPage is creating widgets and thus cannot be created in a different thread, how would I go about doing what I want?
Here's my try at this, but it is not working.
QString content = "<body><div id="hsearch"><form id="search" action="/search" method="get"><div><input name="q" class="textbox" tabindex="1" type="text" maxlength="140" size="28" value="search"></div></form></div><br class="cbt"><div id="hlogo"><a href="/">Stack Overflow</a></div></body>"; // Ignore the quotes and stuff, content is actually retrieved via QNetworkAccessManager
QWebElement docElement;
docElement.setPlainText(content);
QString stackLogoText = docElement.findFirst("a").toInnerXml; // Should return Stack Overflow
But it is not working - just returns an empty string. I also tried setOuterXml()
and setInnerXML()
...
Any ideas?
Upvotes: 1
Views: 1078