Bug report #18679
Cannot insert decimal separator to field
Status: | Closed | ||
---|---|---|---|
Priority: | High | ||
Assignee: | Alessandro Pasotti | ||
Category: | Edit widget | ||
Affected QGIS version: | 3.0.0 | Regression?: | No |
Operating System: | Windows 7 64 bit | Easy fix?: | No |
Pull Request or Patch supplied: | No | Resolution: | fixed/implemented |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 26567 |
Description
Hi, I have PostGIS based layer with numeric field. When i try to edit this field, it is not posible to insert (copy nor write) numbers with decimal separator. Only integer values are alowed. I try use dot as well as comma but with no luck. Also tried to switch QGIS language from United States to my system locale (Czech), but this also didn't work.
Postgres field definition is plain numeric (no scale a precision defined)
QGIS field definition said: double, numeric, -1, -1
It works fine in 2.18.14 (with dot or even comma). Same database, same table, same field.
Related issues
History
#1 Updated by Alessandro Pasotti over 6 years ago
- Status changed from Open to Feedback
- Assignee set to Alessandro Pasotti
I cannot reproduce in current master, would you be able to test a nightly build?
If that still does not work, please attach a minimal project and data (pg_dump) to reproduce the issue.
#2 Updated by David Pavlicek over 6 years ago
I have tested this against latest nightly build from OSGeo (3.1.0-master 4c8b1595a9) with same results...
BUT, after bit of fiddling with this, I thing that real isuue is how editing plugin handles decimal number fields without scale and precision in conjunction with system (Windows) decimal separator settings. When I try to edit decimal number with -1 in scale and precision and with comma (,) as system decimal separator, it does not work! No matter of source layer type (tested with Postgres, shape and memory layer). There is matrix of all data types I have tested with comma as system decimal separator:
numeric(10,5) - WORKS
numeric(-1,-1) - BROKEN
decimal(10,5) - WORKS
real(-1,-1) - BROKEN
double(-1, -1) - BROKEN
When I set system decimal separator to dot (.) everything works... Unfortunately, I cannot simply change my system settings permanently because there are lot of other applications and systems that expects comma as system decimal separator (it is default for my locale).
Hope this helps
#3 Updated by Alessandro Pasotti over 6 years ago
Thanks for the feedback,
So, basically, the problem looks like that the default editor widget for numeric does not take into account your operating system locale decimal separator setting?
How are the locale settings in QGIS options?
Would you mind attaching a small screenshot so that I'm sure we are looking to the same widget?
#4 Updated by David Pavlicek over 6 years ago
- File qgis_locale_setting.png added
- File layer_definition.png added
- File layer_form.png added
- File system_locale_stting.png added
There are screenshots of my system settings, QGIS settings, Layer definition and its Feature form where i try to put in 123.45 (123,45 respectively)...
#5 Updated by Alessandro Pasotti over 6 years ago
- Assignee deleted (
Alessandro Pasotti) - Resolution set to not reproducable
Sorry: I tested this again but I wasn't able to reproduce it on Linux with latest master: I also have "," as a decimal separator and I'm testing with a PostGIS DB with a "numeric" "-1" "-1" field configuration (just like your attached images).
What happens in my tests is that I can enter a number with both (. and ,) as decimal separator: whenever I press a "," it gets automatically converted to a ".".
#6 Updated by Harrissou Santanna over 6 years ago
I don't how or whether this is linked (sorry if it is not) but in another context, i have issues with dot being recognized as decimal separator when editing text box (see #18656).
#7 Updated by David Pavlicek over 6 years ago
Hi again,
i suppose that this issue is specific for Wondows OS and locale with comma as decimal separator. I was able to reproduce it on every machine with Windows (7 or even 10) in our office.
#8 Updated by David Pavlicek over 6 years ago
- Status changed from Feedback to Open
#9 Updated by Jesahel Benoist over 6 years ago
Similar bug there #18963
#10 Updated by Jürgen Fischer over 6 years ago
- Related to Bug report #18963: Can not write a decimal in a real field of a layer spatialite added
#11 Updated by Alessandro Pasotti over 6 years ago
- Assignee set to Alessandro Pasotti
#12 Updated by Alessandro Pasotti over 6 years ago
- Related to deleted (Bug report #18963: Can not write a decimal in a real field of a layer spatialite)
#13 Updated by Alessandro Pasotti over 6 years ago
- Duplicates Bug report #18963: Can not write a decimal in a real field of a layer spatialite added
#14 Updated by Alessandro Pasotti over 6 years ago
Please have a look to https://issues.qgis.org/issues/18963#note-8 and test the attached snapshot on windows.
#15 Updated by Alessandro Pasotti over 6 years ago
- Status changed from Open to Closed
- Resolution changed from not reproducable to fixed/implemented
Fixed with https://github.com/qgis/QGIS/commit/4e37f381dee1e8a54144776c55bedbdf4df14b9b
please test it and report any issue assigning it to me