-
Notifications
You must be signed in to change notification settings - Fork 0
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] Allow users to copy and paste form widget configurations from one field to another #46
base: master
Are you sure you want to change the base?
Conversation
…y and paste configuration actions: copy form config to clipboard and paste form config from clipboard (partial)
…ted for copy&paste (i.e., Fields)
@3nids, before showing this to the world, could you please have a look at this PR? Do we need
|
🪟 Windows buildsDownload Windows builds of this PR for testing. |
…a forceWidgetRefresh param and passing it as true when pasting; note we've respected the previous behavior (i.e., other calls still don't force a refresh) because it seems to be handy to switch between editor widget types (via GUI) without losing the config
… layout; since we only update GUI widgets (and don't automatically store pasted settings into tree item data nor in the field settings themselves), we've added handy methods to edit them
Looking good! |
|
||
void QgsAttributesFormProperties::copyWidgetConfiguration() | ||
{ | ||
QGIS_PROTECT_QOBJECT_THREAD_ACCESS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say they're not requires in these slots.
|
||
const QgsField field = mLayer->fields().field( index ); | ||
|
||
// We won't copy field aliases nor comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would discuss about aliases. I would say it's quite common to have the field in english and have the translated alias. So that would make sense to me to also copy it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please post this in the original issue to discuss it with A. Poncet.
Actually, I've already used this copy&paste functionality (because it was handy for migrating a QGIS project for the Siemens project) and keeping the aliases intact seemed like a good idea. But, let's see what A. Poncet says about the use case you're mentioning.
|
||
// Only paste if source editor widget type is supported by target field | ||
const QgsEditorWidgetFactory *factory = QgsGui::editorWidgetRegistry()->factory( widgetType ); | ||
if ( factory->supportsField( mLayer, fieldIndex ) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we get a form of user feedback on the reason it fails?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'd thought of just logging it so that it's shown in the QGIS log window.
What would be your preferred way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is the message bar available.
But I thought there would be a message bar in the dialog, that might be worth adding one like in QgsAttributeForm.
…traints can be both added and removed from the target field
When configuring forms using the
Drag and Drop Designer
in layers with multiple fields, chances are we want to set similar or even the same configurations for a number of them. 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 of not missing a particular setting by mistake.Implementation details:
Fix 58971
Funded by (?)