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

Better document how to specify QML import name and major version with CMake

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.2.4
    • Documentation
    • None
    • All

      Documentation on how to register QML types the new and better way with QML_ELEMENT is not documented very well right now.

      All the bits and pieces seem to be available in the documentation, but they are a little scattered, and hard to search for. For instance, searching for the right cmake functions to call to achieve the same result as setting QML_IMPORT_NAME and QML_IMPORT_MAJOR_VERSION in a qmake project took me considerable time, and that's with me knowing that there is a way to achieve this with cmake - I just didn't know what the name of the function(s) were.

      Current documentation on the subject seems to be in these places:

      1. https://doc.qt.io/qt-6/qtqml-modules-cppplugins.html
      2. https://doc.qt.io/qt-6/qtqml-cppintegration-topic.html
      3. https://doc.qt.io/qt-6/qqmlengine.html#QML_ELEMENT

      The latter QQmlEngine page specifies the most about this, but it's certainly not in a place people will easily find searching. I think there needs to be a more front-and-center doc page showing the Qt 5.15/Qt 6 new way to register QML types (so they aren't registered procedurally).

      (2) doesn't indicate how to register QML types with cmake at all. This is probably the right place to document this all.

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

            docteam Qt Documentation Team
            kkyzivat Keith Kyzivat
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes