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

createTemporaryQmlObject + importing relative directories

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.9.0
    • Fix Version/s: None
    • Component/s: Testing: QuickTest
    • Labels:
      None
    • Environment:
      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

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

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes