Skip to content

feat(qml/qt): add comprehensive QML extractor and Qt framework resolver (#759) - #2215

Open
hospitaler17 wants to merge 2 commits into
colbymchenry:mainfrom
Union-Work-Place:feat/qml-qt
Open

hospitaler17 wants to merge 2 commits into
colbymchenry:mainfrom
Union-Work-Place:feat/qml-qt

Conversation

@hospitaler17

Copy link
Copy Markdown

Description
This PR expands parsing and graph resolution support for Qt C++ and QML based on review feedback, allowing CodeGraph to seamlessly bridge complex C++/QML boundaries.

Changes

  • QML & qmldir Extractors: Updated qml-extractor.ts to register objectName properties as identifiers for cross-language resolution. Added qmldir-extractor.ts to parse and resolve QML module structures from qmldir files.
  • Qt C++ Framework Resolver (qt.ts): Implemented new extraction passes for modern Qt 6 macros (QML_ELEMENT, QML_SINGLETON). Added extraction for roleNames in QAbstractItemModel to expose C++ properties to QML as JS strings. Added metadata marking (isQEnum: true) for Q_ENUM structures to ensure proper context without polluting the graph.
  • Implicit Connections (callback-synthesizer.ts): Added a new synthesis pass (qtImplicitConnectionsEdges) to bridge implicit dynamic connections created via findChild() and invokeMethod() across the C++/QML boundary.
  • Documentation: Updated README.md to document the new qmldir support and specific Qt/QML features (QML_ELEMENT, roleNames, Q_ENUM, implicit connections).

Related Issues
Closes #759 (QML / Qt C++ support)

This commit introduces full support for Qt C++ and QML in CodeGraph, enabling seamless code intelligence across the C++/QML boundary.

Key additions and improvements:
- QML Extractor: Implemented a structured line-by-line parser for QML that correctly handles component hierarchies, property declarations, signal handlers, inline JavaScript functions, and inline components.
- Qt C++ Framework Resolver: Added qt.ts to identify and resolve Qt-specific patterns such as Q_PROPERTY, Q_INVOKABLE, QML_NAMED_ELEMENT, and signals/slots definitions, linking them across the graph.
- C++ Code Masking: Enhanced the C/C++ parser compatibility by strategically masking Qt annotations (_API exports, Q_INVOKABLE, Q_PROPERTY) with spaces. This prevents tree-sitter from dropping into error recovery while perfectly preserving line and column offsets.
- Signal Dispatch: Traced Qt signal dispatch, correctly identifying emit connections and mapping them to slot handlers.
- Documentation & Tests: Added extensive test suites for QML extraction and Qt signal synthesis. Updated CHANGELOG.md, README.md, and language support documentation.
@hospitaler17 hospitaler17 changed the title feat(qml/qt): add comprehensive QML extractor and Qt framework resolver feat(qml/qt): add comprehensive QML extractor and Qt framework resolver (#759) Oct 1, 2026

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New Feature Request: Could you add QML support for C++/QML applications that work together

1 participant