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

Implement better highdpi handling in QImageReader

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 5.5.0
    • Image formats
    • None

    Description

      Right now @2x handling is spread in several places (qicon, qstylesheet, user code, etc.)

      QImageReader seems a reasonable candidate to partly centralize this behavior:

      • add a autoDevicePixelRatio()/setAutoDevicePixelRatio(bool) method pair.
      • add AutoDevicePixelRatio to QImageIOHandler::ImageOption
      • if the IO handler supports vector scaling (like the SVG handler), autoDevicePixelRatio will be handled by the IO handler, scaling the svg image to the right dpr
      • otherwise, QImageReader will look for an @2x file, and if it finds it, it will read that and set the device pixel ratio to 2.0
      • QPixmap::QPixmap(const QString& fileName, const char *format, Qt::ImageConversionFlags flags), through QPlatformPixmap::fromFile(), will set autoDevicePixelRatio to true. This is because QPixmap is meant to be used for displaying images on screen.
      • QImage(const QString & fileName, const char * format = 0) will NOT set autoDevicePixelRatio to true
      • if autoDevicePixelRatio is false, QImageReader will not set the device pixel ratio on the image, irrespectively of the @2x (see QTBUG-38485)

      Does this make sense? I could work on this if there is some consensus

      Attachments

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

        Activity

          People

            sorvig Morten Sørvig
            lultimouomo Luca Niccoli
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes