Feature request #4749

editable option for combo box in value relation editor cannot be used

Added by Denis Rouzaud over 12 years ago. Updated over 9 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Vectors
Pull Request or Patch supplied:No Resolution:
Easy fix?:No Copied to github as #:14618

Description

In QtDesigner, when checking the editable option for a combo box, and using this UI as an edit form in qgis, when editing the attribute, it will return a NULL value.

I could observe this NULL value using a postgis view with no update rule, QGIS gave me some part of SQL code as an error, and I saw there were NULL values.

History

#1 Updated by Giovanni Manghi about 12 years ago

  • Status changed from Open to Feedback
  • Priority changed from High to Normal

Can you please explain better the issue?

#2 Updated by Denis Rouzaud about 12 years ago

I'll try.

So, for a layer you can use your own edit form by setting a file path in the layer properties dialog, under "general" tab, "Edit UI".

Suppose, you have a field's edit widget defined as "value relation" under the fields tab.

Then, you will draw a combo box for this field in QtDesigner.

Suppose then, that the related table is very long. For example, you chan chosse within a few hundreds of material types for a pipe. Having the colum material in table pipe related to id in table material.

I found a good idea to use the "editable" option in Qt to let the user type the first characters to restrict the choices within the combo box.

But, doing so (i.e. having a combo box editable) prevent the value-relation to be correctly used. Indeed, opening the form of a feature of the pipe layer (the layer being editable mode), will not give the correct identifier for the value relation but will return a NULL value instead (i.e. NULL wil saved in column material in table pipe).

Hope, this is clearer!

#3 Updated by Jürgen Fischer about 12 years ago

  • Category changed from Data Provider/PostGIS to Vectors

Denis Rouzaud wrote:

I found a good idea to use the "editable" option in Qt to let the user type the first characters to restrict the choices within the combo box.

Making it editable means that you can enter new values. That is not supported as that would mean that new values need to be added to the related table. So changing the value of the combobox produces as NULL value.

#4 Updated by Denis Rouzaud about 12 years ago

Okay, I understand.

But there is no way to turn around this? This is strange that if you type the first chars and press enter, the value is effectively in the table, so this should not be null, right?

#5 Updated by Jürgen Fischer about 12 years ago

  • Tracker changed from Bug report to Feature request

Denis Rouzaud wrote:

But there is no way to turn around this? This is strange that if you type the first chars and press enter, the value is effectively in the table, so this should not be null, right?

That could be changed, sure. But for now it's unexpected. Currently qgis doesn't expect the value to be changed and just inspects the selected index and takes the key associated to it.

#6 Updated by Paolo Cavallini over 11 years ago

  • Target version changed from Version 1.8.0 to Version 2.0.0

#7 Updated by Pirmin Kalberer over 11 years ago

  • Target version changed from Version 2.0.0 to Future Release - Nice to have

#8 Updated by Giovanni Manghi almost 10 years ago

  • Status changed from Feedback to Open

#9 Updated by Denis Rouzaud almost 10 years ago

Why turning it back to open?
I filled this request from a misunderstanding at the origin.
Is there a will to implement such functionality?
I am not sure it is worth it.

#10 Updated by Denis Rouzaud over 9 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF