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

[forms] Copy and paste widget configuration when designing forms (Request in QGIS) #9540

Closed
qgis-bot opened this issue Jan 10, 2025 · 2 comments · Fixed by #9617
Closed

[forms] Copy and paste widget configuration when designing forms (Request in QGIS) #9540

qgis-bot opened this issue Jan 10, 2025 · 2 comments · Fixed by #9617
Labels
3.42 QGIS 3.42 new features Properties Vector
Milestone

Comments

@qgis-bot
Copy link
Collaborator

Request for documentation

From pull request qgis/QGIS#60091
Author: @gacarrillor
QGIS version: 3.42

[forms] Copy and paste widget configuration when designing forms

PR Description:

When designing forms (e.g., using the Drag and Drop Designer) in layers with multiple fields, chances are we want to set similar or even the same configurations for some of them that are somehow related (e.g., configuring latitude and longitude field widgets). This process is currently manual, which ends up being a bit tedious and error prone.

This PR adds a handy context menu (in the Vector properties dialog, Attributes Form tab, Available Widgets tree, Fields category, :) ), allowing users to copy widget configurations between fields, and thus, saving time and making sure we'll not miss any particular setting by mistake.

image

Implementation details:

  • Copy&paste of widget configuration can be done between fields of the same layer, between fields from different layers in the QGIS project, or between fields from layers in different QGIS instances.
  • Pasted widget configuration overwrites the target one, but is not applied automatically, so that users can see the pasted configuration and possibly tune it and apply it or avoid saving it by cancelling the dialog or just selecting another field.
  • We avoid copying aliases and comments. The target field ones are respected.
  • A widget configuration can be copied and pasted on the very same field, thus adding support for keeping a widget config in the clipboard, making and testing changes and eventually reverting them by pasting the clipboard content in the same field.
  • We only paste "editor widget configs" when the target field supports the source editor widget type. Otherwise, we leave the target editor widget type and config intact, while showing a warning message (in dialog's message bar) explaining why the config could not be pasted.
    image
  • Target provider constraints are kept, we only paste constraints with layer origin.

Fix #58971


Funded by Ville de Pully (Switzerland)

Commits tagged with [need-docs] or [FEATURE]

@DelazJ
Copy link
Collaborator

DelazJ commented Feb 6, 2025

@gacarrillor

Pasted widget configuration overwrites the target one, but is not applied automatically, so that users can see the pasted configuration and possibly tune it and apply it or avoid saving it by cancelling the dialog or just selecting another field.

"but is not applied automatically," do you mean in the map canvas or in the "attribute forms" GUI? the remaining text made me assume you meant the map canvas. But that is normal, right? given that afaik any action done in the modal layer properties dialog (attribute forms is not in "Layer styling" panel) requiers an "Apply" or "OK" hit before it is propagated to the canvas.

"or just selecting another field": that means if I copy configs from field A, paste them on field B, I have to (tune them and) click dialog "Apply" button before I select anything else, if I want to keep these configs. Otherwise field B properties are reset. Do I get it right?

@gacarrillor
Copy link
Member

@gacarrillor

Pasted widget configuration overwrites the target one, but is not applied automatically, so that users can see the pasted configuration and possibly tune it and apply it or avoid saving it by cancelling the dialog or just selecting another field.

"but is not applied automatically," do you mean in the map canvas or in the "attribute forms" GUI? the remaining text made me assume you meant the map canvas. But that is normal, right? given that afaik any action done in the modal layer properties dialog (attribute forms is not in "Layer styling" panel) requiers an "Apply" or "OK" hit before it is propagated to the canvas.

I meant in the attribute form GUI.

"or just selecting another field": that means if I copy configs from field A, paste them on field B, I have to (tune them and) click dialog "Apply" button before I select anything else, if I want to keep these configs. Otherwise field B properties are reset. Do I get it right?

That was the case when it was implemented. It has been adjusted recently by qgis/QGIS#60192

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.42 QGIS 3.42 new features Properties Vector
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants