-
Notifications
You must be signed in to change notification settings - Fork 78
Open
Labels
Description
It should be technically possible to support QML and HTML widgets in attribute forms on iOS, as QField already demonstrates.
I really don't want to fan a flame here, but it would be nice if you could support something like the following that works in QGIS and QField.
QML Widget:
import QtQuick 2
Loader {
id: loader
width:300;height:30
function getJSON(url, callback) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = 'json';
xhr.onload = function() {
var status = xhr.status;
if (status === 200) {
callback(null, xhr.response);
} else {
callback(status, xhr.response);
}
};
xhr.send();
}
sourceComponent: Text {
id: elev
text: getJSON('https://voibos.rechenraum.com/voibos/voibos?name=hoehenservice&Koordinate='+expression.evaluate("x(transform(@geometry,'EPSG:3857','EPSG:31255'))")+','+expression.evaluate("y(transform(@geometry,'EPSG:3857','EPSG:31255'))")+'&CRS=31255',function(err, data) {if (err == null) { elev.text = data.hoeheDTM.toFixed(2).concat('m'); } else { elev.text = 'Error'}})
}
}HTML Widget:
<h1 id="elev"/>
<script>
function getJSON(url, callback) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = 'json';
xhr.onload = function() {
var status = xhr.status;
if (status === 200) {
callback(null, xhr.response);
} else {
callback(status, xhr.response);
}
};
xhr.send();
};
getJSON('https://voibos.rechenraum.com/voibos/voibos?name=hoehenservice&Koordinate='+expression.evaluate("\"x\"")+','+expression.evaluate("\"y\"")+'&CRS=31255',
function(err, data) {
if (err == null) {
document.getElementById("elev").innerHTML = data.hoeheDTM.toFixed(2).concat('m');
}
});
</script>Reactions are currently unavailable