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

Creating SVG image icons is slow in Print composer #17182

Closed
qgib opened this issue Aug 4, 2013 · 10 comments
Closed

Creating SVG image icons is slow in Print composer #17182

qgib opened this issue Aug 4, 2013 · 10 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter!
Milestone

Comments

@qgib
Copy link
Contributor

qgib commented Aug 4, 2013

Author Name: Pekka Sarkola (@posikifi)
Original Redmine Issue: 8411
Affected QGIS version: master


I create new print composer, then add Image. When I open "Search directories" to select SVG image, QGIS just start to create preview icons: this took hours.

QGIS is logging messages from QT: "QColor::setNamedColor:Unknown color name 'param(fill) #FFF', see image

Tested also in Ubuntu: works fine. In older version (1.8.0): works just fine. Qgis Master version 018e958

This blocks use of QGIS Print Composer (at least in my case)


@qgib
Copy link
Contributor Author

qgib commented Aug 5, 2013

Author Name: Giovanni Manghi (@gioman)


Do you have additionals SVG files other than the ones installed by default? It is just a Windows issue, right?


  • status_id was changed from Open to Feedback
  • fixed_version_id was configured as Version 2.0.0

@qgib
Copy link
Contributor Author

qgib commented Aug 5, 2013

Author Name: Giovanni Manghi (@gioman)


Confirmed on Windows.


  • status_id was changed from Feedback to Open

@qgib
Copy link
Contributor Author

qgib commented Aug 5, 2013

Author Name: Larry Shaffer (Larry Shaffer)


No issue on Mac (10.7.5). May be the QSvgRenderer on Windows (Qt 4.7.1 ?) is having issues with the new SVG symbol library.

Do the same logged errors show up when the SVG previews are shown in symbology dialog?

@qgib
Copy link
Contributor Author

qgib commented Aug 5, 2013

Author Name: Giovanni Manghi (@gioman)


Larry Shaffer wrote:

No issue on Mac (10.7.5). May be the QSvgRenderer on Windows (Qt 4.7.1 ?) is having issues with the new SVG symbol library.

Do the same logged errors show up when the SVG previews are shown in symbology dialog?

no.

Unrelated: see attached screenshot. Almost all svg symbols now render with no fill and a very clear outline, and they are hard to see. Is this right?


  • 6119 was configured as 09.png

@qgib
Copy link
Contributor Author

qgib commented Aug 5, 2013

Author Name: Larry Shaffer (Larry Shaffer)


Ok, I've tracked down the issue, but not sure how to fix it.

Running the following from PyQGIS shell, gives a similar Qt warning (output to the Log Messages panel):

from PyQt4.QtSvg import QSvgRenderer
QSvgRenderer("C:/OSGeo4W/apps/qgis-dev/svg/backgrounds/background_square.svg")

1. which produces these warnings
QColor::setNamedColor: Unknown color name 'param(fill) #FFF'
QColor::setNamedColor: Unknown color name 'param(outline) #000'

When I removed all but that SVG file from the standard app SVG library, I got a repetition of 4 (8 total warnings) for testing and rendering that single file to the QgsComposerPictureWidget's icon view. This means the Log Messages panel is flooded with messages when trying to load all the default SVGs to the view. This is what causes the slowness, not necessarily the warnings themselves (at least I'm pretty sure).

The extra logging appears to be related to improvements Jürgen has done for Windows in main.cpp. The same issue might happen on Mac, except that loading the SVG file into the QSvgRenderer on Mac does not produce any warnings.

Those same Qt warnings also showed up when launching any project that already has a composer picture item in its layout, which, for some projects, slowed down their launching.

I was not able to determine why the QgsSvgCache rendered the same SVG file without logging those warnings. Also, I was not able to see how to disable those warnings specifically for @QgsComposerPictureWidget::addDirectoryToPreview@.

On a side note: this is not really a release blocker, since the flooding of warnings to Log Messages probably does not occur.

@qgib
Copy link
Contributor Author

qgib commented Aug 5, 2013

Author Name: Pekka Sarkola (@posikifi)


So, if slowness is coming from logging of warnings: workaround could be disable logging. Not very nice. Maybe there should be somewhere possibility to disable all loggings. IMHO: logging should be disabled by definition, only advanced users/developers need logging.

Reply to sidenote about blocker: maybe not for a release, but for my case. I wasn't sure what it means (blocker).

@qgib
Copy link
Contributor Author

qgib commented Aug 6, 2013

Author Name: Larry Shaffer (Larry Shaffer)


Pekka Sarkola wrote:

So, if slowness is coming from logging of warnings: workaround could be disable logging. Not very nice. Maybe there should be somewhere possibility to disable all loggings. IMHO: logging should be disabled by definition, only advanced users/developers need logging.

Logging is disabled for the release builds. Generally, nightly builds of the master branch (like you are using) are built with debugging output on, because they are intended to be used for testing. If you took the current master and built it as a release variant, the problem would probably not present itself. I am assuming the issue of the SVG params not being read by the Windows QSvgRenderer has been around for quite some time, with new logging tools just having exposed it.

Not sure how to turn logging off for the debug builds, with regards to this issue, however. Still curious why those rendered SVGs in QgsSvgCache (canvas SVG marker symbology or the SVG picker in symbology) are not logging the warnings.

Reply to sidenote about blocker: maybe not for a release, but for my case. I wasn't sure what it means (blocker).

It's certainly a blocker for those using a debug build on Windows, though. :^)

@qgib
Copy link
Contributor Author

qgib commented Aug 7, 2013

Author Name: Nathan Woodrow (@NathanW2)


Fixed in changeset "ee268984de32d631ee5cd57dd895dc8d8977000e".


  • status_id was changed from Open to Closed

@qgib
Copy link
Contributor Author

qgib commented Aug 7, 2013

Author Name: Nathan Woodrow (@NathanW2)


This is fixed now by suppressing the warning for setNamedColor. It's not ideal but having a slow composer when using SVG isn't good because it can mask other issues.

@qgib
Copy link
Contributor Author

qgib commented Aug 7, 2013

Author Name: Larry Shaffer (Larry Shaffer)


Thanks Nathan,

Maybe a more specific string comparison, so it doesn't mask other QColor::setNamedColor warnings/errors?

QColor::setNamedColor: Unknown color name 'param(

or, a regex comparison?

QColor::setNamedColor:[^']*'param\\(

@qgib qgib added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label May 24, 2019
@qgib qgib added this to the Version 2.0.0 milestone May 24, 2019
@qgib qgib closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter!
Projects
None yet
Development

No branches or pull requests

1 participant