GSoC/GCI Archive
Google Code-in 2012 KDE

Marble: Port the checkboxes of the MarbleLegendBrowser to QWebView

completed by: Illya Kovalevskyy

mentors: Torsten Rahn, René Küttner, Dennis Nienhüser

During a previous task the MarbleLegendBrowser has been ported to QWebView - except for the checkboxes.

For the checkboxes we want to use "normal" HTML: Previously to render a checkbox we had used this code:

<a href="checkbox:cities"><span style="text-decoration: none"><img src="checkbox:cities">&nbsp;</span></a> Populated Places

This code has to be replaced in the legend and in the source code by this code:

<input type="checkbox" name="cities" value="citiesValue"> Populated Places<br>


Now we just need to get notified when the user clicks this checkbox and we need to check the value and perform the required actions.

NOTE: The following suggestions haven't been tried yet, so they are just supposed to be food for thought and might turn out to be not fully workable solutions:

Getting notified of a change should be easy:

There's a signal contentsChanged() that should get emitted once a checkbox gets triggered.

You should be able to access the value associated with the checkboxes via:

document = webview->mainFrame()->documentElement();  

QWebElement firstInput = document.findFirst("input[type=checkbox]");

bool storedValue = firstInput.attribute("checked");

So in the end you probably need a table that stores the initial value and checks for changes.


If this doesn't appear to be a workable solution you could also port the previous approach if possible.