musescore / musescore/muse_framework

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

Open
#273 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
12
Forks
57
Avg merge
1d 22h
Merged PRs (30d)
37

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the listed muse framework files, especially framework/dockwindow/qml/Muse/Dock/dockpanelview.cpp and framework/extensions/qml/Muse/Extensions/devtools/devextensionslistmodel.cpp, and inspect each qmlRegister* call and its includes. Check the generated-code and macOS cases separately, then build against Qt 6.11 to confirm the muse files compile without transitive QML headers. Audacity src/ files are outside this repository's scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
67/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.