Bug report #16745

Relation reference widget: entries with a primary key of 0 are not properly displayed in combobox

Added by Andreas Neumann over 3 years ago. Updated over 3 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Edit widget
Affected QGIS version:2.18.9 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:24644

Description

Ways to reproduce:

1.
Load two tables with a common key. The second table should be no-geometry "value list" table, with a primary key and entries starting from 0.

2.
Create a relation in the project properties relation manager

3.
Configure a relation reference widget with the share primary key

4.
Make sure that some values in the geometry table reference pkey with value 0 in the no-geometry "value list" table

Bug:
If the common pkey is 0, there is no display value shown in the combobox of the relation reference widget.

Associated revisions

Revision 6d2bab68
Added by Matthias Kuhn over 3 years ago

Return invalid fid instead of null fid

The default comparison code for two QVariants does a really crappy job
when it comes to NULL values.
I.e. it will return true for `QVariant( 0 ) == QVariant( QVariant::Int )`
We work around this issue here by returning an invalid QVariant instead,
which - and luckily also Qt is aware of this - also is different from 0.

Fix #16745

Revision bf94df83
Added by Matthias Kuhn over 3 years ago

Return invalid fid instead of null fid

The default comparison code for two QVariants does a really crappy job
when it comes to NULL values.
I.e. it will return true for `QVariant( 0 ) == QVariant( QVariant::Int )`
We work around this issue here by returning an invalid QVariant instead,
which - and luckily also Qt is aware of this - also is different from 0.

Fix #16745

History

#1 Updated by Anonymous over 3 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

Also available in: Atom PDF