I'm modifying the DOM Traversal example that comes with Qt. However, whenever I see a link, I want to "go" to that URL and also traverse its DOM, but I don't want to reload the GUI. Right now I'm still using the code from the example to get the homepage:
void Window::on_webView_loadFinished()
{
treeWidget->clear();
QWebFrame *frame = webView->page()->mainFrame();
QWebElement document = frame->documentElement();
examineChildElements(document, treeWidget->invisibleRootItem());
}
This works great. In examineChildElements(), when I encounter a specific link, I then call another function with the URL (I checked the URL string; it's correct):
void Window::parse_page(QString page_URL)
{
QWebView *innerPage = new QWebView();
innerPage->setUrl(page_URL);
QWebFrame *frameInner = innerPage->page()->mainFrame();
QWebElement documentBetrieb = frameInner->documentElement();
get_biz_info(documentBetrieb);
delete innerPage;
return;
}
But when I traverse this document (documentBetrieb), there is only an HTML tag. Is there a step I'm missing, or a way of putting the DOM from a URL directly into a QWebElement without using QWebView?