Hi Bo, With the qml widget, you can mostly do shiny data representation, it's not optimized for editing. Have a look at this blog post from my colleague Dave https://www.opengis.ch/2018/11/06/qml-widgets-qgis/
It's also possible to create custom widgets with python, but it requires a few classes to be implemented. The main entry point is registering a custom QgsEditorWidgetFactory with https://qgis.org/pyqgis/3.40/gui/QgsEditorWidgetRegistry.html#qgis.gui.QgsEditorWidgetRegistry.registerWidget and from the factory create new QgsEditorWidgetWrappers. This will create new widgets which can (if you want) also be based on https://doc.qt.io/qt-6/qquickwidget.html and render QML this way. There is an example on https://github.com/opengisch/stdm/blob/master/stdm/ui/forms/spatial_unit_form.py (without QML). Best wishes Matthias On Sat, Jun 7, 2025 at 4:09 PM Bo Victor Thomsen via QGIS-Developer < [email protected]> wrote: > Hi list - > > 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? > > And the why ? : > > I have a postgres table, where one of the fields is a "jsonb" object. I > can *show* 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). > > 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. > > 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. > > Or design a QML document which shows the json element in a number of > combo-boxes. > > And hence the question: Can i replace the field value with the changed > version from a QML widget. And how ?? > > > > > -- > Med venlig hilsen / Best regards > > Bo Victor Thomsen > > _______________________________________________ > QGIS-Developer mailing list > [email protected] > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer >
_______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
