With this code you can open a window with a LineEdit, which offers an automatic completion (here index 0).
my_vector_layer = iface.activeLayer()
w = qgis.gui.QgsFieldValuesLineEdit()
w.setLayer(my_vector_layer)
w.setAttributeIndex(0)
w.show()
I want to embed this in the object form that appears after adding an object. I'm struggling a little with the PyQGIS documentation. So it's going in this direction:
iface.openFeatureForm(layer, feat, True)
- How do I get the above code embedded in openFeatureForm?
- Generally I want a link with the attributes of another layer. Without PyQGIS this is possible in the layer properties under attribute form and value relation. But how do I address this and the other control element types of the attribute form in PyQGIS?