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

js files cause app to fail to run with ambiguous errors

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P1: Critical P1: Critical
    • 6.10
    • 6.10.0 Beta2
    • None
    • macOS Sequoia 15.6 (24G84)
      2025 MacBook Air M4
    • macOS

      Similar to other bugs already reported, may be the same as: https://bugreports.qt.io/browse/QTBUG-138391

       

      Including a .js file in a module causes the application to fail to load with an error about ambiguity. 

      warning: qrc:/qt/qml/MyProject/src/qml/PlanetList.qml: "MyProject" is ambiguous. Found in qrc:/qt/qml/MyProject/ and in qrc:/qt/qml/MyProject/

      The offender is actually the js file under QML_FILES when adding the module in CMakeLists.txt

      qt_add_qml_module(appMyProject
          URI MyProject
          VERSION 1.0
          QML_FILES
              Main.qml
              PlanetList.qml
              NumberFormatter.js
        )

       

      In the release build of Qt, the app will run when the .js file is in the root folder, as above. Moving it to another folder causes the error about ambiguity. In the 6.10.0-beta2 version, the app fails to run even with the .js file in the project's root directory.

      Disabling policy QTP0004 resolves the failure to start:

      # workaround for bug with javascript files
      qt_policy(SET QTP0004 OLD)

      More information has been posted on the forums: https://forum.qt.io/topic/163000/ambiguous-project-when-using-files-in-subdirectory/2

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

            qtqmlteam Qt Qml Team User
            doktornik Nikolas Fraser
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes