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

Qt.createQmlObject filepath parameter does more than documented

XMLWordPrintable

      In documentation of createQmlObject:

      If filepath is specified, it will be used for error reporting for the created object.

      http://doc.qt.io/qt-5/qml-qtqml-qt.html#createQmlObject-method

      Additionally, if this path is file url (such as file:///path/to/somewhere), it will also be used as a search directory for relative files referenced in created QML object. For example:

      Qt.createQmlObject('import QtQuick 2.4; Image{ source:"file.png" }', parent, "file:///tmp/something.qml")
      

      This will search file.png from /tmp.

      Either this feature should be removed (and search should be relative to file where this new object was created) or this should be added to documentation.

      In case this is staying, should http scheme (and others) also be supported? Now only file seems to be working this way.

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

            docteam Qt Documentation Team
            poikelin Joni Poikelin
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes