Looking at the signals in the QtWebKit API, I failed to find anything that would seem to me to be what I am looking for.
QWebView
linkClicked()
seems to be the closest, but a reset button is no link, and definitely does not point to an URL.
QWebPage
- I considered the following signals (judging by their name), but according to their description none of them match my purpose either:
contentsChanged()
,contentsChanged()
,contentsChanged()
,selectionChanged()
.
- I considered the following signals (judging by their name), but according to their description none of them match my purpose either:
QWebFrame
- None of its signals matches my purpose.
QWebElement
- Here I can see how to get an object representing the button(s), but it has no signals whatsoever.
I want to catch a click in a reset button in order to store the data in the form before it gets cleared, so it can be restored later.
For now, I did manage to retrieve the buttons as a QWebElementCollection
of QWebElement
objects, and I can modify them, but I do not know how to get them to send a signal upon click, or something similar.
// Get reset buttons.
QWebElementCollection inputResets = mainFrame()->documentElement().findAll("input[type=reset]");
inputResets += mainFrame()->documentElement().findAll("button[type=reset]");
// Change their text (just a test).
foreach(QWebElement element, inputResets)
{
element.setPlainText("Worked!");
}