How do I document an accessor function with the same name as a Q_PROPERTY?
This is a known bug or rather unimplemented feature. As of today, it's not possible to document a property and a getter if they have the same name. The getter's documentation will always end up in the property's one.
The reason for this is doxygen
's findmember
implementation. If you use doxygen -d findmembers
you can see that both size
(the property) and size()
(the function) "match":
findMemberDocumentation(): root->type=`int' root->inside=`' root->name=`Widget::size' root->args=`() const ' section=6000000 root->spec=0 root->mGrpId=-1 findMember(root=0x197efe0,funcDecl=`int Widget::size() const ',related=`',overload=0,isFunc=1 mGrpId=-1 tArgList=(nil) (#=0) spec=0 lang=200 findMember() Parse results: namespaceName=`' className=`Widget` funcType=`int' funcSpec=`' funcName=`size' funcArgs=`() const' funcTempList=`' funcDecl=`int Widget::size' related=`' exceptions=`' isRelated=0 isMemberOf=0 isFriend=0 isFunc=1 1. funcName=`size' 2. member name exists (2 members with this name) 3. member definition found, scope needed=`Widget' scope=`Widget' args=`' fileName=/tmp/test/example.cpp 4. class definition Widget found 5. matching `'`() const' className=Widget namespaceName= 6. match results of matchArguments2 = 1
You can even reproduce this with another non-const
variant int size()
. You will end up with three members that have the same name. Doxygen cannot handle properties and functions with the same name at the moment and does not document the getters in this case.
If you don't need the property documentation, you can disable the Q_PROPERTY
macro in your Doxyfile
(as documented):
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
PREDEFINED = Q_PROPERTY(x)=
That way the lexer won't scan Q_PROPERTY
.