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

User-provided versions for QtQuick.Controls are not passed to QtQuick.Templates

    XMLWordPrintable

Details

    Description

      This means that the templates are loaded with the static version given in the relevant Control.qml file (or none, which means "latest"). Since most properties are declared and revisioned in the templates, this makes our versioning scheme entirely ineffective for QtQuick.Controls. For example:

      Attempting to load this QML with qmlscene:

      import QtQuick.Controls 2.2
      
      RoundButton {
          property string icon: ""
      } 

      Produces the error: 

      file:///home/.../MyButton.qml:4 Cannot override FINAL property
      

      Despite the fact that the icon property was introduced in QtQuick.Controls 2.3 and this code imports QtQuick.Controls 2.2.

      There are a few possible solutions for this:

      1. Duplicate all the controls .qml files for each version that needs to be made available. That's not physically impossible, but clearly insane.
      2. Abandon the "templates" pattern and find some replacement from QQC. This sounds like a compatibility nightmare.
      3. Find a way to forward the version a module was imported with into its components and add syntax to use it, like "import QtQuick.Controls auto". Ulf has tried that and it's not easy. It may yet be possible, though.
      4. Add an "internal" qmldir-import. In qmldir imports you can already write "auto" and it works. The problem is that qmldir-imports are exposed not only to the module itself, but also to anyone who imports it. Restricting this to only the module itself is likely easier than the other options.

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              nocnokneo Taylor Braun-Jones
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes