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

QImageReader::size is inefficient and incorrect for SVG files.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • P3: Somewhat important
    • None
    • 4.7.0
    • SVG Support
    • None

    Description

      QImageReader::size "Returns the size of the image, without actually reading the image contents.", according to the docs.
      With SVG files this isn't true - it seems to read the entire file:

      QVariant QSvgIOHandler::option(ImageOption option) const
      {
      switch(option) {
      ...
      ...
      case Size:
      d->load(device()); – THIS LOADS THE WHOLE SVG
      return d->defaultSize;
      break;

      Surely all that is needed (in most cases at least) is to return the width and height attributes of the outermost svg element?

      It will also return an incorrect result if the size in the SVG file isn't specified in pixel units.
      According to the SVG Tiny spec, "the 'width' and 'height' attributes on the outermost 'svg' element can specify values in any of the following CSS units: in, cm, mm, pt, pc, and %."
      Qt seems to ignore the actual unit specified, and assume a pixel unit instead.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            daveyb David Bignell
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes