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

Relative path in a separate module stored in a variable works not as expected in qrc environment

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 6.1.0 Beta2
    • None

    Description

      I've stuck into this bug when was working with image component wrapped in item that was in a separate module. To specify path for an icon i made url property.
      If i launch my application with qrc resources, qml for some reason thinks that i set url directly in my component, not from main file.
      To clarify the problem, these are the minimal steps to reproduce the bug:
      1) Create qt quick empty application
      2) Create a qml file in a new folder
      3) This file should contain

      import QtQuick 2.15
      import QtQuick.Controls 2.15
      
      Item {
          required property url iconPath
          
          Image {
              source: iconPath
          }
      }
      

      4) Import folder in main qml file and create an instance of created file
      5) Provide a relative path to an icon(i saved it in the same folder as main file)
      If i set iconPath to "icon.png" from main file qml gives me this error:
      QML Image: Cannot open: qrc:/components/icon.png
      But logically path should be qrc:/icon.png/ and if i set iconPath to "../icon.png" everything works.
      I've not seen this bug in 5.15.2

      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
              adjsky Kirill Timchenko
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes