Skip to content

Fix handling of Doxygen property members (Q_PROPERTY)#1047

Open
AlexanderKosik wants to merge 1 commit intobreathe-doc:mainfrom
AlexanderKosik:fix-qproperty-support
Open

Fix handling of Doxygen property members (Q_PROPERTY)#1047
AlexanderKosik wants to merge 1 commit intobreathe-doc:mainfrom
AlexanderKosik:fix-qproperty-support

Conversation

@AlexanderKosik
Copy link

Summary

This PR fixes a crash in Breathe that occurs when Doxygen emits a element, which is typically produced when parsing Qt’s Q_PROPERTY macro. Breathe currently has no mapping for the property kind in the internal DomainDirectiveFactory, causing a KeyError during documentation rendering.

This change adds handling for Doxygen "property" members and maps them to an appropriate Sphinx C++ domain directive so that Breathe can continue rendering without error.

Problem

Qt’s Q_PROPERTY macro is widely used in C++/Qt projects.
Doxygen interprets these macros and generates XML entries like: <memberdef kind="property" ...>
When Breathe processes the XML and attempts to dispatch this member kind, it fails because "property" is not included in the cpp_classes mapping.

This results in an exception:

KeyError: 'property'
  File ".../breathe/renderer/sphinxrenderer.py", line 338, in create
    cls, name = DomainDirectiveFactory.cpp_classes[args[0]]

Reproduction/Example

class Example : public QObject {
    Q_OBJECT

    /*
    * \property value 
    * The existence of this will fail
    */
    Q_PROPERTY(double value READ value WRITE setValue)

private:
    double value() const;
    void setValue(double);
};

With this input, Doxygen generates a property entry which Breathe cannot process, triggering the above KeyError.

Thank you

Thank you for maintaining Breathe and continuing to support the C++/Sphinx ecosystem.
I hope this patch helps improve Qt compatibility and avoid crashes for other users facing the same issue.

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.

1 participant