2

I am trying to use the range widget in QGIS attribute forms to allow the user to enter values in steps on 0.25 so values of (0.25,0.5,0.75,1,1.25...)

Range widget

The settings above result in values of 0.49, 0.74, 0.99, 1.24, 1.49... Always 0.01 short of what I am looking for, if I increase the precision the value always end in a 9 or a 4.

enter image description hereenter image description here

QGIS 3.28, 3.30 windows

1 Answer 1

1

I have the same problem on QGIS 3.34, regardless of the precision of the field datatype. I think you should file this as a bug on GitHub.

It seems like a problem when incrementing from NULL. One way around it is to disable Allow NULL and change the minimum to 0.00 so that the widget appears with 0.00 by default (visual only), which allows proper incrementing.

Add an enforced expression constraint such as "decimal_field_name" >= 0.25 so users are visually prompted to increment to at least 0.25 before saving the feature.

3
  • I can confirm that disabling "Allow NULL" corrects the incrementing which makes it look more like a bug. Sadly many of my expressions use "is not null" so I need to put aside some time to re-write a lot of expressions. I would file it as a bug but I am confident it will be explained as something to do with storing numbers as hexadecimal values and is numerically correct.
    – Sethinacan
    Commented Feb 21 at 9:48
  • 2
    If you are uncertain about submitting it as a bug, I might do so in the morning - I don't think this is acceptable form UI/UX even if it can be explained away. I'm guessing it can probably be solved fairly simply. It's an issue even in 3.16, but going back to 2.18 it seemed to work properly... albeit starting from the wrong minimum value. in both those versions.
    – she_weeds
    Commented Feb 21 at 13:06
  • 1
    @Sethinacan bug reported here github.com/qgis/QGIS/issues/56476
    – she_weeds
    Commented Feb 22 at 6:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.