Bug report #17878
QGIS 3 Vector Layer Fields Garbled when Clicking the Toggle Editing Icon
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Windows 7, Linux||Easy fix?:||No|
|Pull Request or Patch supplied:||Yes||Resolution:||fixed/implemented|
|Crashes QGIS or corrupts data:||Yes||Copied to github as #:||25773|
QGIS Version: 2.99.0-268
Attached is a sample geopackage file. Load the file into QGIS. Open the Attribute Table. Now click on the "Toggle Editing" toolbar icon. Watch the attribute table. For me, the first entry immediately becomes garbled. See the before and after images.
[bugfix] Fix minimum values for range widgets
Fixes #17878 QGIS 3 Vector Layer Fields Garbled when Clicking the Toggle Editing Icon
#5 Updated by Alessandro Pasotti over 3 years ago
- Operating System changed from Windows 7 to Windows 7, Linux
- Category changed from Vectors to Attribute table
- Status changed from Open to In Progress
- Priority changed from Normal to High
Ok, I've probably found the issue with NULLs and I'll commit a patch soon, but I think we have another separate issue here that is the precision of the numeric floating point fields.
It is set to 0 by default that in code is implemented like leave the widget its own default that is 2 decimal positions.
I didn't try very hard, but I've not found an easy way to change it from the layer properties.
Would you mind filing a separate bug to discuss the precision issue?
I'm not sure about what the expected outcome should be, I think it would make sense to have more decimal places by default (like 6) and definitely there must be a way to configure that in the field configuration of the layer properties.
#10 Updated by Calvin Hamilton over 3 years ago
- File bad_data.jpg added
- Status changed from Closed to Reopened
I just tested this today and it is not quite fixed although the behavior has changed. There are two issues that I see:
1. This is the lesser problem. Right mouse click on the test layer and select "Open Attribute Table". In the window click on the "Toggle editing mode" icon then click it again. Because nothing was changed it shouldn't do anything, but it pops up the windows asking if you want to save it. It shouldn't do that. Interestingly, if you click on the Discard button and the keep clicking on the "Toggle editing mode" button you won't see the dialog box again.
2. For this test make sure you have closed the attribute table and then reopen it. Click on the "Toggle editing mode" icon just once. Now select the "Add Point Feature" icon and click on the map to add a feature. For 'label' I just called it test and left 'latitude' and 'longitude' as NULL. What it does is garbles the data in the first row and the new data is added to line 6 with 'Autogenerate' as the fid. See the attached image. Compare this with the attribute_table_before.jpg image attached with the initial bug report.
#12 Updated by Alessandro Pasotti over 3 years ago
Yes, I've only fixed one of the series of bugs that you are reporting, which is the NULL issue on negative values (I think you called it "garble").
I've also done another PR for setting the precision on double fields, but that is a separate (but related) issue.
With your last comment you are probably reporting yet another issue.
I'd really prefer to see them in different tickets, or it gets much more difficult to track what has been fixed and what has not and refering to a ticket in the commit will just close it (like it happened when I fixed the NULL issue).
Besides: what exactly do you mean with "garble"? Can you try to be more precise?
There is yet another related PR in the queue that might help with the "dirty" state of the layer: https://github.com/qgis/QGIS/pull/6191