Skip to content

qmlRegisterType and related functions not declared - missing #include <QQmlEngine> #273

Description

@astrojuanlu

I've been trying to build Audacity 4 against KDE's Qt 6.11 and had to include a series of patches to make it work. What follows is an AI-generated report of one of such issues. I see no contributing or AI guidelines so I hope this is acceptable.


Multiple module registration source files across the muse framework call qmlRegisterType(), qmlRegisterSingletonType(), qmlRegisterUncreatableType(), and qmlRegisterUncreatableMetaObject() without including <QQmlEngine>. These functions are declared in <QQmlEngine> (Qt6) / <QtQml/qqmlengine.h>, but the files only include <qqmlintegration.h>, which does not provide them. The calls compile only when <QQmlEngine> is transitively included through other headers — a dependency that varies between Qt distributions and is being actively removed.

Environment

  • muse framework commit: 3c5512eb8ee1a863a6123e62bd75a6ab55045752
  • Qt: Built from the KDE Qt fork (the source of the kde-qt6-core24-sdk snap), version 6.11.1

Root cause

In Qt 5, qmlRegisterType() and friends were commonly available through transitive includes from <QtQml>. In Qt 6, the declaration lives in <QQmlEngine> (forwarding to qtqml/qqmlengine.h). The muse framework's module files include <qqmlintegration.h> (for QML_ELEMENT macros) but not <QQmlEngine>. With upstream Qt, <QQmlEngine> is transitively pulled in through other headers; with the KDE Qt fork (which has cleaner transitive include paths), it is not, causing compilation failures.

Affected files

The following files in the muse framework call qmlRegister* functions without including <QQmlEngine>:

  • framework/dockwindow/qml/Muse/Dock/dockpanelview.cpp
  • framework/rcommand/qml/Muse/RCommand/rcommandmodule.cpp (via generated code)
  • framework/extensions/qml/Muse/Extensions/devtools/devextensionslistmodel.cpp
  • framework/shortcuts_v2/qml/Muse/Shortcuts/platform/macos/macosshortcutsinstancemodel.mm (macOS only)

Note: Many of the affected files are actually in Audacity's own src/ directory (e.g. src/automation/automationmodule.cpp, src/playback/playbackmodule.cpp, etc.) rather than in the muse framework itself. Those should be reported to the Audacity repository.

Additionally, files that pass QQmlEngine* or QJSEngine* as lambda parameters to qmlRegisterSingletonType need <QQmlEngine> and <QJSEngine>:

  • framework/interactive/qml/Muse/Interactive/interactiveprovidermodel.h (uses QQmlEngine in a MOC-registered method)

Suggested fix

Add #include <QQmlEngine> (and #include <QJSEngine> where lambdas use QJSEngine*) to all files that call qmlRegister* functions. Alternatively, consider providing a muse-internal header (e.g. muse_qmlregistration.h) that includes the necessary Qt6 QML headers, so module authors only need to include one muse header.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions