Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sensible default field precision for new fields #36524

Merged
merged 4 commits into from
May 18, 2020
Merged

Sensible default field precision for new fields #36524

merged 4 commits into from
May 18, 2020

Conversation

alexbruy
Copy link
Contributor

Description

Couple of UX fixes related to fields length and precision:

  • don't pre-select default geometry type in the new SpatiaLite dialog (consistent with other new layer dialogs)
  • field length and precision validators in the New Memory Layer dialog now respect native provider types
  • sensible default field precision in the Add Field dialog (same as in Field Calculator, fixes Sensible default width and precision for real columns #16581)

@alexbruy alexbruy added the GUI/UX Related to QGIS application GUI or User Experience label May 18, 2020
@nyalldawson
Copy link
Collaborator

Unrelated Travis nonsense

@nyalldawson nyalldawson merged commit 231a2df into qgis:master May 18, 2020
@uclaros
Copy link
Contributor

uclaros commented May 18, 2020

@nyalldawson @alexbruy I think the newmemorydialog stuff should be done just like in qgsaddattrdialog. Read the native types for the provider, then fill the ui accordingly.
That way if we want to add a new type tomorrow or correct a type we do it in one place ( in the provider ), and also it will be safer from mistakes like setting the mWidth for the decimal number to 30 but its validator to 20, like in this PR.

@alexbruy alexbruy deleted the field-precision branch May 19, 2020 03:53
@elpaso
Copy link
Contributor

elpaso commented Jul 8, 2020

@alexbruy this commit causes a regression: try to add a new field to a PG layer, leave the default smallint type and save commits:

Could not commit changes to layer value

Errors: SUCCESS: 1 attribute(s) added.
ERROR: field with index 6 is not the same!
Provider: postgres
Storage: PostgreSQL database with PostGIS extension
expected field: name=ooo type=int typeName=int2 len=-1 precision=3
retrieved field: name=ooo type=int typeName=int2 len=-1 precision=0

The field is actually created but you cannot leave the editing state.

@alexbruy
Copy link
Contributor Author

alexbruy commented Jul 9, 2020

@elpaso should be fixed by #37697

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GUI/UX Related to QGIS application GUI or User Experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sensible default width and precision for real columns
4 participants