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

createTemporaryQmlObject + importing relative directories

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.9.0
    • Testing: QuickTest
    • None
    • Windows 10 Enterprise 64 bit (x64)

      QT Creator 5.9

      minw_32

    Description

      When using createTemporaryQmlObject(), imports in the qml string (first argument) appear not support relative paths, or at least the path it is relative to is not the desired path.

      Given a tst_Bubba.qml like this:

      function test_bubba() {
              var item = createTemporaryQmlObject("import QtQuick 2.0; import \"../App\"; Bubba {}", testCase);
              compare(item.color, "#ff0000")
              mouseClick(item, 0, 0, Qt.LeftButton);
              compare(item.color, "#00ff00")
      }
      

      Where ../App/Bubba.qml exists relative to tst_Bubba.qml, the following error is given:

      Uncaught exception: Qt.createQmlObject(): failed to create object:
      file:///C:/Qt/Qt5.9.0/5.9/mingw53_32/qml/QtTest/undefined:1:21: "../App": no such directory
      

      If I don't use createTemporaryQmlObject but rather have:

      import QtQuick 2.0
      import "../App"
      
      Bubba {
      }
      

      "Bubba" resolves just fine.

      Attachments

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

        Activity

          People

            mitch_curtis Mitch Curtis
            mrc13 Ryan Carmichael
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes