-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[feature] Allow embedded SVG symbols via base 64 encoding #7433
Conversation
Allows SVG images for symbology, labels, etc to be directly embedded inside a project file (or QML style, or QPT print template!) by encoding the svg as a standard base64 string. Sponsored by SMEC/SJ
Adds a common widget for SVG sources, with a tool button with some handy options: - select file (old behaviour), pick a file from disk - embed file (pick a file from disk, is embedded into project/symbol) - extract embedded file (for embedded files, allows you to save these back to a disk based svg file) - from url (opens a dialog prompting for a url, exposing the previously hidden functionality that svgs can be retrieved from a remote url (eg github)) Sponsored by SMEC/SJ
@nyalldawson nice! I did not look or build the code, but am wondering about colors for the embedded svg's. Some background: http://blog.sourcepole.com/2011/06/30/svg-symbols-in-qgis-with-modifiable-colors/ and https://gis.stackexchange.com/questions/45180/how-to-create-svg-symbols-that-have-modifiable-fill-color-stroke-color-and-stro |
Nope -- if you embed a "parameterised" svg (those which allow color changing), then it'll still be parameterised and allow color changes after embedding. |
Nice! Thanks a lot! Often, projects have many SVG files linked and if one wants to exchange that with others, it would be a lot of work to manually embed or extract all SVG files. |
@nyalldawson , just tested the PR, nice work. Few issues:
|
@nirvn |
Compiled, and tested with a qml + custom icons (bird and bat findings) I just got from a client: Works fine! Thanks Some usability comments:
Anyway: thanks for this PR |
@andreasneumann |
@rduivenvoorde Thanks for the feedback and testing!
I'm not sure. I'd consider tweaking colors or sizes a more frequent operation than changing the actual SVG file. We probably should discuss this on the list to get more feedback before any changes.
I'm not sure what we can do here, that sounds like a deficiency in the toolkit dialog itself. (I find this too often with the GNOME/GTK save/open dialogs). We could add a messagebox explanation before the file dialog, but that'd get annoying quickly if you were exporting a few...
See above :) |
(As outlined in qgis/QGIS-Enhancement-Proposals#126)
Allows SVG images for symbology, labels, etc to be directly embedded inside a project file (or QML style, or QPT print template!) by encoding the svg as a standard base64 string.
Also adds a common widget for SVG sources, with a tool button with some handy options:
The vast majority of the churn here is due to the UI - the actual core change is only 4 lines long! But we had multiple different code paths implementing a svg selector line edit and the corresponding logic, so I've taken the opportunity to create a standard widget to share the code between these.