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

Duplicate policy on QgsFields when duplicate features #57217

Merged
merged 6 commits into from
May 8, 2024

Conversation

signedav
Copy link
Contributor

@signedav signedav commented Apr 22, 2024

Description

On duplicating a feature (and it's children) the duplicate policy will be concerned for fields. There are three options:

Screenshot from 2024-04-22 11-38-37

Default is "Duplicate Value".

A good use case where this is useful is on a timestamp as default value, when this feature has been created (means duplicated).

Technical info

This functionality is implemented the same way than the split policy, although the split policy is based on the policy of the field domain (if available) what means it concerns the OGRFieldDomainSplitPolicy. This is not part of the duplicate policy. The duplicate policy only concerns the QgsFields and is configured over the attribute form properties.

Still I named the enum FieldDomainDuplicatePolicy - because maybe one time the OGR api offers this policy as well and with this we can use it the same way.

That's why it's named FieldDuplicatePolicy.

@github-actions github-actions bot added this to the 3.38.0 milestone Apr 22, 2024
@@ -521,8 +521,7 @@ Qgis::GeometryOperationResult QgsVectorLayerEditUtils::splitFeatures( const QgsC
switch ( field.splitPolicy() )
{
case Qgis::FieldDomainSplitPolicy::DefaultValue:
// TODO!!!

//do nothing - default values ​​are determined
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment concerns not the duplicate policy but the split policy. I removed your "TODO" @nyalldawson because as far as I understand the default values are determined by doing "nothing".

@SGroe
Copy link

SGroe commented Apr 22, 2024

This fixes #55477

@nyalldawson
Copy link
Collaborator

@rouault

Still I named the enum FieldDomainDuplicatePolicy - because maybe one time the OGR api offers this policy as well and with this we can use it the same way.

I'm curious -- Are you aware of any formats which store this information?

@rouault
Copy link
Contributor

rouault commented Apr 22, 2024

Are you aware of any formats which store this information?

no, nothing comes to mind.

@signedav
Copy link
Contributor Author

Thanks for your thoughts @nyalldawson and @rouault Still I think this is the best place there, to have it aligned to the other (similar) settings. Maybe we can rename it to FieldDuplicatePolicy to imply that it has nothing to do with domains. What do you think?

@m-kuhn
Copy link
Member

m-kuhn commented May 6, 2024

Thanks for your thoughts @nyalldawson and @rouault Still I think this is the best place there, to have it aligned to the other (similar) settings. Maybe we can rename it to FieldDuplicatePolicy to imply that it has nothing to do with domains. What do you think?

I agree @signedav this is independent from "domains", so FieldDuplicatePolicy would be more appropriate (or rather using Domain would not be appropriate)

Copy link

github-actions bot commented May 6, 2024

🪟 Windows builds ready!

Windows builds of this PR are available for testing here. Debug symbols for this build are available here.

(Built from commit cfe7197)

…ot like the Merge or Split Policy it does not affect the FieldDomains but only the Fields instead
@signedav signedav force-pushed the duplicatepolicy branch from 43618ec to cfe7197 Compare May 7, 2024 12:28
@signedav signedav added the Needs Documentation When merging a labeled PR, an issue will be created in the Doc repo. label May 8, 2024
@qgis-bot
Copy link
Collaborator

qgis-bot commented May 8, 2024

@signedav
This pull request has been tagged as requiring documentation.

A documentation ticket will be opened at https://github.com/qgis/QGIS-Documentation when this PR is merged.

Please update the description (not the comments) with helpful description and screenshot to help the work from documentors.
Also, any commit having [needs-doc] or [Needs Documentation] in will see its message pushed to the issue, so please be as verbose as you can.

Thank you!

@signedav signedav merged commit d0d2023 into qgis:master May 8, 2024
33 checks passed
@signedav signedav deleted the duplicatepolicy branch May 8, 2024 17:53
@qgis-bot
Copy link
Collaborator

qgis-bot commented May 8, 2024

@signedav
A documentation ticket has been opened at qgis/QGIS-Documentation#9085
It is your responsibility to visit this ticket and add as much detail as possible for the documentation team to correctly document this change.
Thank you!

@DelazJ DelazJ added Feature Changelog Items that are queued to appear in the visual changelog - remove after harvesting labels May 9, 2024
@qgis-bot
Copy link
Collaborator

qgis-bot commented May 9, 2024

@signedav

This pull request has been tagged for the changelog.

  • The description will be harvested so please provide a "nearly-ready" text for the final changelog
  • If possible, add a nice illustration of the feature. Only the first one in the description will be harvested (GIF accepted as well)
  • If you can, it's better to give credits to your sponsor, see below for different formats.

You can edit the description.

Format available for credits
  • Funded by NAME
  • Funded by URL
  • Funded by NAME URL
  • Sponsored by NAME
  • Sponsored by URL
  • Sponsored by NAME URL

Thank you!

@zacharlie zacharlie added ChangelogHarvested This PR description has been harvested in the Changelog already. and removed Changelog Items that are queued to appear in the visual changelog - remove after harvesting labels Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ChangelogHarvested This PR description has been harvested in the Changelog already. Feature Needs Documentation When merging a labeled PR, an issue will be created in the Doc repo.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants