Uploaded image for project: 'Qt Design Studio'
  1. Qt Design Studio
  2. QDS-15826

2D View and runtime resolve assets paths differently

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Not Evaluated Not Evaluated
    • None
    • QDS 4.7.2
    • runtime
    • None

      Minimal reproduction project: https://git.qt.io/mikio_hirai/qdspathissue#

      2D view and runtime resolve asset paths differently when the path is calculated during runtime.

      The project structure is:

      PathIssueContent(folder)
      – App.qml
      – CustomTypes(folder)
         – Dog.qml
         – dog.png
         – doge.png 

      In Dog.qml, it calculates source property during runtime.

      import QtQuick
      Image {
          enum DogType {
              Dog,
              Doge
          }
          property int type: Dog.Dog
          source: type === Dog.Dog ? "dog.png" : "doge.png"
      }
       

      App.qml uses Dog.qml.
      As you can see, 2D View correctly shows the image.

       

      However, when the app is run, it doesn't show the image.

      With this warning:

      11:50:37: Starting C:\Qt\Tools\QtDesignStudio\qt6_design_studio_reduced_version\bin\qmlpuppet-4.7.2.exe --qml-runtime -I C:/Users/81808/Downloads/PathIssue/. --apptype widget C:/Users/81808/Downloads/PathIssue/PathIssueContent/App.qml...
      11:50:37: Cannot retrieve debugging output.
      QML debugging is enabled. Only use this in a safe environment.
      Info: Starting QML Runtime
      Warning: file:///C:/Users/81808/Downloads/PathIssue/PathIssueContent/App.qml:12:5: QML Dog: Cannot open: file:///C:/Users/81808/Downloads/PathIssue/PathIssueContent/dog.png 

      Here, in runtime, the path in Dog.qml is resolved relative to the file using Dog.qml, which is App.qml.
      In my opinion, it seems natural to align the runtime path resolution to the way 2D view does; paths are resolved relative to the file refering to them.

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

            javihria Jarko Vihriälä
            mikio_hirai Mikio Hirai
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes