View Full Version : How to follow a a href hyperlink?

18th September 2013, 19:46
Hi all!

I've been searching the internet for how follow a <a href> hyperlink on Qt Webkit, and as I found nothing about it, I am now asking for help in this forum.

I've tested with this code:

void MainWindow::putPagina1()
QWebElement el = ui->webView->page()->mainFrame()->findFirstElement("a[href]");


The source code of the website is as follows:

<h1><a href="button1.html">Click here if you are button 1</a></h1>
<h1><a href="button2.html">Click here if you are button 2</a></h1>

The idea is this: when you press button1, the browser displays button1.html and when you press button2, the browser displays button2.html .

Thank you!