Bug report #20714

Value relation widget with multiple selection don't work anymore with custom UI

Added by Tudor Bărăscu almost 3 years ago. Updated almost 3 years ago.

Category:Edit widget
Affected QGIS version:3.5(master) Regression?:Yes
Operating System:Debian Buster Easy fix?:No
Pull Request or Patch supplied:No Resolution:wontfix
Crashes QGIS or corrupts data:No Copied to github as #:28534


In QGIS master and the release-3_4 branch, adding a custom UI with a list widget (value relation) pointing to an array column in Postgresql doesn't work anymore.
I don't see the List widget cannot be editable.

On the left side of the below picture is the currently look versus the 2.18 on the right side:

I tried using a QgsCheckableComboBox and although I can see the workers and select them QGIS tries to save the last selected one as an integer and it doesn't work (as I have an array of integers in the column).
You can bypass this by writing code but I would have expected that a custom UI just worked for this case.

I've attached a test project.
Step 1, create the tables:

\c bugtest;
CREATE TABLE work_planning (id serial PRIMARY KEY, fk_workers integer[]);
CREATE TABLE workers (id serial PRIMARY KEY, worker varchar(100));
INSERT INTO workers (worker) SELECT 'worker 1';
INSERT INTO workers (worker) SELECT 'worker 2';
INSERT INTO workers (worker) SELECT 'worker 3';
INSERT INTO workers (worker) SELECT 'worker 4';

Step 2, open the bugtest.qgs project with Master or Madeira and try to add a new work_planning feature:

It doesn't work.
It works on the bugtest2.18.qgs if you open it in 2.18.

The widget settings:

problem.jpg (16.5 KB) Tudor Bărăscu, 2018-12-04 08:45 AM

bugtest.zip - the replicating project (7.55 KB) Tudor Bărăscu, 2018-12-04 08:56 AM

widget_settings.jpg (37.2 KB) Tudor Bărăscu, 2018-12-04 09:22 AM


#1 Updated by Denis Rouzaud almost 3 years ago

  • Resolution set to wontfix
  • Status changed from Open to Feedback

QGIS expects it to be a table widget.
This has changed here https://github.com/qgis/QGIS/commit/471e67f1fb635fb8b6486eb02c42d8934df016e7#r31566504

I would propose to keep it as is if it's ok for you.

#2 Updated by Tudor Bărăscu almost 3 years ago

  • Status changed from Feedback to Open

It's ok! Thank you Denis! It seems I cannot close the issue while on Feedback.

#3 Updated by Tudor Bărăscu almost 3 years ago

  • Status changed from Open to Closed

Closing now.

Also available in: Atom PDF