Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of QML and HTML Widgets on iOS #3692

Open
cxcandid opened this issue Dec 5, 2024 · 1 comment
Open

Support of QML and HTML Widgets on iOS #3692

cxcandid opened this issue Dec 5, 2024 · 1 comment

Comments

@cxcandid
Copy link

cxcandid commented Dec 5, 2024

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>
@VitorVieiraZ
Copy link
Contributor

Hello @cxcandid , thanks for the report. Currently, we already have support for HTML widgets and you can use them normally on iOS. QML widgets, on the other hand, are still not available in the app at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants