Doxygen: arguments and methods with the same names



  • Slightly off topic, I realise, but I wanted to ask if anybody knows how to prevent doxygen producing links to methods from function arguments with the same name.
    For example: in this documentation, QModelIndex buddy (const QModelIndex &index) the index argument is made into a link to the totally unrelated index(int row, int column, const QModelIndex &parent method. Do you know how to prevent this?


  • Moderators

    @VRonin
    even if you explicitly describe the param? (with \param)



  • Just tested:

    /*!
    Constructs a new proxy model with the given \a parent.
    \param parent The Qt parent object
    */
    TransposeProxyModel::TransposeProxyModel(QObject* parent)
    

    still links to the TransposeProxyModel::parent(const QModelIndex &index) method


  • Lifetime Qt Champion

    Hi,

    From this stackoverflow answer, you need to add the % just before the word.

    Hope it helps



  • @SGaist Yep, that's what I do when I reference it in a comment but this link is auto-produced from the function signature


  • Lifetime Qt Champion

    Are you putting the method signature in the documentation or do you let Doxygen do that automatically ?



  • In the exameple above I have :

    In header:

    explicit TransposeProxyModel(QObject* parent = Q_NULLPTR);
    QModelIndex buddy(const QModelIndex &index) const Q_DECL_OVERRIDE;
    

    in source:

    /*!
    Constructs a new proxy model with the given \a parent.
    \param parent The Qt parent object
    */
    TransposeProxyModel::TransposeProxyModel(QObject* parent)
    {/*some nasty implementation*/}
    
    /*!
    \reimp
    */
    QModelIndex TransposeProxyModel::buddy(const QModelIndex &index) const 
    {
        /*some nasty implementation*/
    }
    

    So the links are totally auto-generated


  • Moderators

    @VRonin said in Doxygen: arguments and methods with the same names:

    \param parent The Qt parent object

    in the link i've posted before the it's mentioned with @param, maybe this results in a different behavior?

    Also you can explicitly declare the function the documentation belongs to using \fn. Maybe then you can apply the workaround of @SGaist




Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.