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

Unexpected scope for Url resolvement

    XMLWordPrintable

Details

    Description

      Unexpected scope for Url resolvement

      See: https://git.qt.io/public-demos/qtdesign-studio/-/blob/master/playground/AuroraCluster/content/ClusterComponents/ClusterBackground.ui.qml

      
      import QtQuick
      
      Image {
          id: carViewScreenAsset
          source: Qt.resolvedUrl("assets/carViewScreen.svg")
      }
      

      We have to use Qt.resolvedUrl in this case which is unexpected, since "assets/carViewScreen.svg" is the correct relative url for ClusterBackground.ui.qml.

      But since Image is the root element the url is resolved in the context of CarViewScreen.ui.qml, and the url is not correctly resolved unless we 'manually' add Qt.resolvedUrl.
      Image/carViewScreenAsset has two contexts in this case the one from 'ClusterBackground.ui.qml' and the one from 'CarViewScreen.ui.qml'.
      Currently the outer context is used which is at least confusing in this case.

      And: https://git.qt.io/public-demos/qtdesign-studio/-/blob/master/playground/AuroraCluster/content/CarViewScreen.ui.qml

      Attachments

        Issue Links

          Activity

            People

              qtqmlteam Qt Qml Team User
              thohartm Thomas Hartmann
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: