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

qt_add_qml_module(): Reject invalid inputs

    XMLWordPrintable

Details

    • 6e536aba7 (dev), 18f491a19 (dev), 7144c6802 (dev), 92c642cd2 (6.9), 3b8a397e2 (tqtc/lts-6.8)

    Description

      Example 1

      As explained at https://doc.qt.io/qt-6/qtqml-modules-identifiedmodules.html , QML URIs cannot contain dashes/hypens. If we try to use "import My-Module", then

      • qmlsc will produce a compilation error ("Main.qml:2:10: error: Expected token `;'")
      • Uncompiled QML code will produce a runtime error with the same message

       

      Example 2

      C++ class names cannot contain dashes. "MyPlugin" is OK but "My-Plugin" is not.

       

      However, qt6_add_qml_module() currently accepts these illegal inputs:

      qt6_add_qml_module(My-Module
          URI My-Module # <-- Accepted by CMake, but generated module is not importable
          CLASS_NAME My-Plugin # <-- Accepted by CMake, but the generated C++ code is broken
          # ...
      )
      

       

      Suggestion
      CMake should produce an error at configure-time if an invalid input is detected.

      Attachments

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

        Activity

          People

            semlanik Alexey Edelev
            skoh-qt Sze Howe Koh
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews