<div dir="ltr">Hi Bo,<div><br></div><div>With the qml widget, you can mostly do shiny data representation, it's not optimized for editing.</div><div>Have a look at this blog post from my colleague Dave <a href="https://www.opengis.ch/2018/11/06/qml-widgets-qgis/">https://www.opengis.ch/2018/11/06/qml-widgets-qgis/</a></div><div><br></div><div>It's also possible to create custom widgets with python, but it requires a few classes to be implemented.</div><div>The main entry point is registering a custom QgsEditorWidgetFactory with <a href="https://qgis.org/pyqgis/3.40/gui/QgsEditorWidgetRegistry.html#qgis.gui.QgsEditorWidgetRegistry.registerWidget">https://qgis.org/pyqgis/3.40/gui/QgsEditorWidgetRegistry.html#qgis.gui.QgsEditorWidgetRegistry.registerWidget</a> and from the factory create new QgsEditorWidgetWrappers. This will create new widgets which can (if you want) also be based on <a href="https://doc.qt.io/qt-6/qquickwidget.html">https://doc.qt.io/qt-6/qquickwidget.html</a> and render QML this way.</div><div>There is an example on <a href="https://github.com/opengisch/stdm/blob/master/stdm/ui/forms/spatial_unit_form.py">https://github.com/opengisch/stdm/blob/master/stdm/ui/forms/spatial_unit_form.py</a> (without QML).</div><div><br></div><div>Best wishes</div><div>Matthias</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Sat, Jun 7, 2025 at 4:09 PM Bo Victor Thomsen via QGIS-Developer <<a href="mailto:qgis-developer@lists.osgeo.org">qgis-developer@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>

  

    
  
  <div>
    <p>Hi list - <br>
    </p>
    <p>I've been doodling a while using the QML widget i QGIS (version
      3.42, Windows) : and I have a question: Is it possible to design a
      editing widget using the QML widget as a base? <br>
    </p>
    <p>And the why ? : </p>
    <p>I have a postgres table, where one of the fields is a "jsonb"
      object. I can <i>show</i> the json values using the "Json view"
      widget or even make the elements of the json object editable using
      the "key/value" widget (my json object are "flat": only a series
      of key/value pairs). </p>
    <p>However, I would like to add a drop-down value list to some of
      the elements in the jsonb field, so the user can choose a value
      from a list instead of writing the value using a keyboard.<br>
    </p>
    <p>As far as i can see, i have couple of potential choices: Try to
      subclass the "key/value" widget if that's possible from python and
      extend the functionality. </p>
    <p>Or design a QML document which shows the json element in a number
      of combo-boxes.</p>
    <p>And hence the question: Can i replace the field value with the
      changed version from a QML widget. And how ??    <br>
    </p>
    <p><br>
    </p>
    <p>  <br>
    </p>
    <pre cols="72">-- 
Med venlig hilsen / Best regards

Bo Victor Thomsen</pre>
  </div>

_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div>