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

GUI for dynamic SVGs #40892

Merged
merged 6 commits into from
Jan 8, 2021
Merged

GUI for dynamic SVGs #40892

merged 6 commits into from
Jan 8, 2021

Conversation

3nids
Copy link
Member

@3nids 3nids commented Jan 7, 2021

This adds the GUI for settings the parameters of dynamic SVGs in the symbology:

image

core part has been done in #40596
implements qgis/QGIS-Enhancement-Proposals#199

@3nids 3nids added the Feature label Jan 7, 2021
@3nids 3nids requested a review from nirvn January 7, 2021 14:08
@nirvn
Copy link
Contributor

nirvn commented Jan 7, 2021

Completely cool. I'll review tomorrow.

@github-actions github-actions bot added this to the 3.18.0 milestone Jan 7, 2021
@zacharlie zacharlie added the Changelog Items that are queued to appear in the visual changelog - remove after harvesting label Jan 7, 2021
@nyalldawson
Copy link
Collaborator

UI thing: can you flip the +/- buttons to sit on the bottom right? That's where we usually place them in widgets like this

@3nids
Copy link
Member Author

3nids commented Jan 8, 2021

@nyalldawson here you go:
Screenshot 2021-01-08 at 07 44 18

@3nids 3nids added the Needs Documentation When merging a labeled PR, an issue will be created in the Doc repo. label Jan 8, 2021
@qgis-bot
Copy link
Collaborator

qgis-bot commented Jan 8, 2021

@3nids
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!

Copy link
Contributor

@nirvn nirvn left a comment

Choose a reason for hiding this comment

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

Code looks good.

I think the UI/UX here would greatly benefit from auto-discovery of such parameters in the source SVG file. If no dynamic parameters are found (a simple regular expression match would probably work here), disable the group box. If dynamic parameters are found, enable the group box and auto fill the tree widget with discovered parameters.

In fact, we could get rid of the [+] and [-] button interface altogether that way.

Without auto-discovery, my fear is that this super useful feature will be underutilized. It can be addressed in a follow up PR.

{
const QModelIndexList selectedRows = mParametersTreeView->selectionModel()->selectedRows();
if ( selectedRows.count() > 0 )
mParametersModel->removeParameter( selectedRows.at( 0 ) );
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth tweaking the code to allow for more than one parameter to be removed per button click.

Copy link
Member Author

Choose a reason for hiding this comment

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

done in 1562a49

@@ -2839,6 +2851,15 @@ void QgsSVGFillSymbolLayerWidget::setFile( const QString &name )
emit changed();
}

void QgsSVGFillSymbolLayerWidget::setSvgParameters( const QMap<QString, QgsProperty> &parameters )
{
// TODO mLayer->setParameters(parameters);
Copy link
Contributor

Choose a reason for hiding this comment

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

Still TODO?

Copy link
Member Author

Choose a reason for hiding this comment

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

I will address this in a following PR to enable the params for SVG fills.

@3nids
Copy link
Member Author

3nids commented Jan 8, 2021

I think the UI/UX here would greatly benefit from auto-discovery of such parameters in the source SVG file. If no dynamic parameters are found (a simple regular expression match would probably work here), disable the group box. If dynamic parameters are found, enable the group box and auto fill the tree widget with discovered parameters.
In fact, we could get rid of the [+] and [-] button interface altogether that way.

it's not that easy. Consider the SVG file path is data defined. In such scenario it's difficult/impossible to inspect all possible files.

Without auto-discovery, my fear is that this super useful feature will be underutilized. It can be addressed in a follow up PR.

I agree, this would be a very useful follow up.

@3nids 3nids merged commit 0120e0f into qgis:master Jan 8, 2021
@3nids 3nids deleted the svg-dyn-gui branch January 8, 2021 08:19
@qgis-bot
Copy link
Collaborator

qgis-bot commented Jan 8, 2021

@3nids
A documentation ticket has been opened at qgis/QGIS-Documentation#6428
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!

@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 Jan 10, 2021
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.

5 participants