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

Modernize docs for creating QQmlEngineExtensionPlugin

XMLWordPrintable

    • 2ca9d70c17 (qt/qtdeclarative/dev) 2ca9d70c17 (qt/tqtc-qtdeclarative/dev) f6c45eeda3 (qt/qtdeclarative/6.3) 39756f0a23 (qt/qtdeclarative/6.4) 39756f0a23 (qt/tqtc-qtdeclarative/6.4)

      According to https://doc.qt.io/qt-6/qqmlengineextensionplugin.html#details, the first step is to subclass QQmlEngineExtensionPlugin and add the Q_PLUGIN_METADATA() macro.

      However, doing this together with the latest CMake QML API will cause errors:

      multiple definition of `qt_plugin_query_metadata'
      multiple definition of `qt_plugin_instance'
      

      This is because qt_add_qml_module() + qt_add_library() already auto-generates a QQmlEngineExtensionPlugin subclass for the library, so the developer should not do this manually.

       

      Notes

      To see the auto-generator in action, simply use Qt Creator 8.0 to generate a Hello World plugin: "File" > "New Project..." > "Library" > "Qt Quick 2 Extension Plugin"

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

            fabiankosmale Fabian Kosmale
            skoh-qt Sze Howe Koh
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: