qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.66k stars 3.02k forks source link

Wrong step/increment in Range Widget when "Allow NULL" is selected #34394

Open PedroVenancio opened 4 years ago

PedroVenancio commented 4 years ago

Describe the bug The step/increment in Range Widget is wrong, when "Allow NULL" is selected. Please see the screencast:

range_widget

The "Allow NULL" option seems to have some issues: https://github.com/qgis/QGIS/issues/31245

How to Reproduce

  1. Open this project: range_widget.zip

  2. Test like in the screencast.

QGIS and OS versions

QGIS version 3.10.2-A Coruña QGIS code revision 032ed312e4
Compiled against Qt 5.11.2 Running against Qt 5.11.2
Compiled against GDAL/OGR 3.1.0dev Running against GDAL/OGR 3.1.0dev
Compiled against GEOS 3.8.0-CAPI-1.13.1 Running against GEOS 3.8.0-CAPI-1.13.1
Compiled against SQLite 3.29.0 Running against SQLite 3.29.0
PostgreSQL Client Version 11.5 SpatiaLite Version 4.3.0
QWT Version 6.1.3 QScintilla2 Version 2.10.8
Compiled against PROJ 7.0.0 Running against PROJ Rel. 7.0.0, March 1st, 2020
OS Version Windows 10 (10.0) This copy of QGIS writes debugging output.
Active python plugins BackupLayer; DataPlotly; geoprocAlgos; getools; gml_application_schema_toolbox; go2streetview; HCMGIS; lrs; MultiDistanceBuffer; ntv2_transformations; photo2shape; pointsamplingtool; postgis_geoprocessing; PotentialSlopeFailure; processing_circuitscape; processing_gnm; processing_js; processing_prepair; processing_saga; profiletool; qchainage; Qgis2threejs; QNEAT3; quick_map_services; refFunctions; SemiAutomaticClassificationPlugin; SentinelHub; statist; SwapVectorDirection; timemanager; verifica_lotesrp; VoGisProfilTool; db_manager; MetaSearch; processing

Additional context

alexbruy commented 4 years ago

Step works as expected if "Allow NULL" is unchecked.

alexbruy commented 4 years ago

Actually it also works with "Allow NULL" checked. And this clearly visible in the screencast: each step increments by 0.5 which is a step value configured for this field. Also this can be verified by entering any value manually and then using up/down buttons to increase or decrease number.

PedroVenancio commented 4 years ago

Hi @alexbruy

So the expected behaviour is, when Allow NULL is checked, it count also de zero ("0.0")?

For instance, if the minimum is 0 and the Allow NULL is checked and the step defined as 0.5, it counts: 0.0 ... 0.1 ... 0.2 ... 0.3 ... 0.4 ?

I can understand it, but it does not seem very intuitive, because my understanding of Allow NULL in this context was only to give the opportunity to the user to leave the field without be filled with any value. Imagine in my use case. That field should store the air temperature (degrees celsius, ºC). If I uncheck the Allow NULL, it uses 0.0 as default, but 0.0ºC is a valid temperature value (unlike for instance precipitation), and it will break all subsequent data analysis. This makes sense?

alexbruy commented 4 years ago

We don't use 0 (zero) as NULL. For NULL used special value, which in this case (if I read code correctly) is min - step. So if I understand initial issue, problem appears when widget has NULL value by default (for example new feature was digitized) and clicking on the up arrow produces wrong result.

PedroVenancio commented 4 years ago

So if I understand initial issue, problem appears when widget has NULL value by default (for example new feature was digitized) and clicking on the up arrow produces wrong result.

Exactly @alexbruy

Pedro-Murteira commented 2 years ago

Still an issue on QGIS 3.22.3.

elpaso commented 2 years ago

@Pedro-Murteira you are doing an amazing job in checking all old issues!!! Thank you!

Pedro-Murteira commented 2 years ago

@elpaso thank you very much! I'm glad to be helping QGIS!

lindacamathias commented 2 years ago

still an issue in QGIS 3.24.1

koenigherford commented 11 months ago

I can confirm, its still an issue in QGIS 3.34. / the connection to "Allow NULL"-checkbox is not very intuitive

Unfortunately changing the "Allow NULL"-checkbox is not allowed (greyed out) when using "Range-Slider" or "Range-Dial" instead of "Range-Editable": As a workaround you have to change to "Range-Editable", then adjust "Allow NULL"-checkbox and then change back to "Range-Slider" or "Range-Dial" -setting.

grafik

koenigherford commented 11 months ago

my intuitive thought was that using a slider with step "10" will allow only "0,10,20,30..."-values.

But it is sliding in "1"-steps when moving the slider-button by mouse. Only when clicking on the slider-line beneath the silder-button there are "10"-steps (but the will end up for example in 14,24,34,..., when silder is set to 4 first)

grafik

koenigherford commented 11 months ago

When exporting the project to QFIELD and using the slider there, the slider works als expected: Just in 10-steps by using the slider-button or by clicking on the line.

It will be nice, when QGIS will work in the same way the developers of QFIELD imagined.