Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Doxygen: arguments and methods with the same names
QtWS25 Last Chance

Doxygen: arguments and methods with the same names

Scheduled Pinned Locked Moved Solved 3rd Party Software
9 Posts 3 Posters 2.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • VRoninV Offline
    VRoninV Offline
    VRonin
    wrote on last edited by
    #1

    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?

    "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
    ~Napoleon Bonaparte

    On a crusade to banish setIndexWidget() from the holy land of Qt

    raven-worxR 1 Reply Last reply
    0
    • VRoninV VRonin

      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?

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

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

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • VRoninV Offline
        VRoninV Offline
        VRonin
        wrote on last edited by
        #3

        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

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

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

          Hope it helps

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          VRoninV 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

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

            Hope it helps

            VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on last edited by
            #5

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

            "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
            ~Napoleon Bonaparte

            On a crusade to banish setIndexWidget() from the holy land of Qt

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

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

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • VRoninV Offline
                VRoninV Offline
                VRonin
                wrote on last edited by
                #7

                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

                "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                ~Napoleon Bonaparte

                On a crusade to banish setIndexWidget() from the holy land of Qt

                raven-worxR 1 Reply Last reply
                0
                • VRoninV VRonin

                  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

                  raven-worxR Offline
                  raven-worxR Offline
                  raven-worx
                  Moderators
                  wrote on last edited by raven-worx
                  #8

                  @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

                  --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                  If you have a question please use the forum so others can benefit from the solution in the future

                  1 Reply Last reply
                  1
                  • VRoninV Offline
                    VRoninV Offline
                    VRonin
                    wrote on last edited by
                    #9

                    Apparently this is a known bug: https://stackoverflow.com/questions/51212831/doxygen-arguments-and-methods-with-the-same-names

                    "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                    ~Napoleon Bonaparte

                    On a crusade to banish setIndexWidget() from the holy land of Qt

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved