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

Provide a way of optionally importing or selecting modules

    XMLWordPrintable

Details

    Description

      QtQuick.Controls selects a style to be imported at runtime by evaluating a file qtquickcontrols2.conf and some environment variables. Additionally it allows the style to be selected via C++.

      We want something similar for QtQml.WorkerScript. Usage of WorkerScripts is not very common and forcing everyone to load the workerscript plugin is a waste. There should be a way of declaring an import as optional in a qmldir file:

      optional import QtQml.WorkerScript auto
      

      This would import WorkerScript if the user has not specified otherwise. However, a per-application configuration file or an environment variable might customize the behavior. This would supersede the current qtquickcontrols2.conf, and make the behavior configured in there accessible to QML tooling.

      [QtQml]
      Import=QtQml.Models,MyOwnStaticImport
      OtherThings=Foo,Bar
      
      [QtQuick.Controls]
      Import=QtQuick.Controls.Material
      
      [QtQuick.Controls.Material]
      Theme=Light
      Accent=Teal
      Primary=BlueGrey
      

      The file would be read by the QML engine and the Import configurations would be applied when loading a module. Other entries would be made available through public API.

      Attachments

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

        Activity

          People

            qtqmlteam Qt Qml Team User
            ulherman Ulf Hermann
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes