Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-37058

QWebView fails to render svg image from Qt resource file, but renders the same image taken directly from filesystem.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.3.0 Beta1
    • 5.1.1, 5.2.0
    • None
    • Qt 5.1.1, Qt 5.2.0
      OSX 10.9, Windows 7, Linux 64 bit (Ubuntu 13.10).
    • ae197e4992d9f8c63bf5d0c0f72f712dbe09b1ae

    Description

      Svg image added to qrc file is not displayed properly in QWebView. The same image taken from filesystem is displayed well.

      In attached project there's html file with stylesheet and svg image (with animation). 3 div elements with different background settings:
      1. Always takes image from Qt resourses.
      2. Relative path to image, it takes it from resources, if HTML is loaded from resources, and takes from filesystem if HTML is loaded from filesystem.
      3. Always takes image from filesystem. Path to that image in Resources/style.css should be replaced with actual path on your filesystem.

      By default, html is loaded from resources, so in divs 1 and 2 background is taken from resources, and displayed incorrectly.
      If you drop index.html into QWebView area, div 2 with relative path will be displayed correctly.

      Also, if you remove svg module from project settings and run macdeployqt after build (so that svg plugin is not deployed with application), divs that use qrc background don't render it at all, and divs that use background from filesystem support all SVG features.

      It seems like Qt SVG plugin, that supports only tiny svg 1.2 is used by WebKit whenever embedded (in .qrc resources) svg images are used, but for svg images from filesystem WebKit uses it's own engine.

      Note: if svg file alone from qrc is loaded into QWebView - it is rendered ok, that is weird...

      Attachments

        Activity

          People

            allan.jensen Allan Sandfeld Jensen
            sergei.nevdakh Sergei Nevdakh
            Votes:
            5 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: