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

Selective import statements for QML

    XMLWordPrintable

Details

    Description

      A way to reduce the name clashes with multiple imports via a Python-like syntax:

      from QtQuick 2.0 import Rectangle, MouseArea
      
      Rectangle {}  // OK
      Item {} // NOT FOUND
      MouseArea {} // OK
      
      from QtQuick 2.0 as QQ2 import Rectangle
      
      Rectangle {} // NOT FOUND
      QQ2.Rectangle {} // OK
      QQ2.Item {} // NOT FOUND
      
      from QtQuick 2.0 import Rectangle as R, MouseArea as M
      
      Rectangle {} // NOT FOUND
      R {} // OK, alias for Rectangle
      

      And similar variations.

      The rationale is minimizing the clashes, just like in other languages.

      With the drop of versioned module imports in QML3, either one namespaces everything or we need something like this for long-term big-scale QML projects.

      Attachments

        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
            peppe Giuseppe D'Angelo
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes