Bug report #16745
Relation reference widget: entries with a primary key of 0 are not properly displayed in combobox
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
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
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 7 years ago
- % Done changed from 0 to 100
- Status changed from Open to Closed
Applied in changeset qgis|6d2bab68ff40f0f2ef4c630ea92c591e644ba5df.