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

move remote resource loading from Qt Quick to QtCore

    XMLWordPrintable

Details

    Description

      The fact that we have code for this in qquickpixmapcache.cpp (etc) at all is IMO a lame workaround for the fact that Qt does not have a virtual filesystem framework.  As pointed out elsewhere, Gnome has gvfs, KDE has KIO... what do we have?  well perhaps QAbstractFileEngine... not sure if that's a way forward.  So we've done ad-hoc stuff like this.  It doesn't make sense that Qt Quick has to concern itself with network fetching; and it doesn't make sense that we treat network-loaded images as something special, but can't necessarily load arbitrary resources without more independent work (textual content, CSS files, fonts, QML files, JSON and other data formats, 3D models, and so on).  We have taken pains to use QUrl instead of QString anywhere that we might have naively wanted a "source" or "path", but often those properties still can't load anything but a local file on a mounted filesystem.

      QTextDocument::resource() ought to be able to load remote resources, but we shuffle it off to the user instead, with the resourceProvider() function.  Probably one of the main use cases for that is to load resources from the network.

      Because QtPDF provides an QImageIOHandler and treats PDF as an image format, it works with QQuickPixmap: you can write

       Image { source: "http://server/something.pdf" }

      which is nice, but the architecture was partially dictated by the fact that Qt doesn't have a VFS.  Some day we will stop treating PDF as an image format.  We need to get the GPU to render the primitives that are found in the PDF, so it's fast and scalable and doesn't depend on pdfium's independent raster engine.  And we need to do that for SVG too.  But if you bypass QQuickPixmap, you lose the remote-loading feature.

      There are plenty of other uses.  We can't keep staying on the desktop and ignoring the web.  Even on the desktop, there are many, many use cases for loading network resources.  We should have been inspired by KIO and done something similar, more portable, and more naturally asynchronous, a long, long time ago.

      Attachments

        Issue Links

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

          Activity

            People

              cnn Qt Core & Network
              srutledg Shawn Rutledge
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes