Results 1 to 5 of 5

Thread: What Doxygen tag should I use when a function emits a signal?

  1. #1
    Join Date
    Jan 2014
    Posts
    36
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default What Doxygen tag should I use when a function emits a signal?

    I'm trying to document my code using doxygen, and I'm trying to figure out what the correct tag (if any exists) to use.

    I've got a member function that is called whenever an internal QTimer's timeout() signal is emitted. When this happens, this class emits a signal of it's own to notify external class that the timeout happened. So here's my current documentation and function:

    Qt Code:
    1. /**
    2.  * @brief Called when timer times out
    3.  *
    4.  * This function is called when the timer times out.
    5.  * Emits sigTimeout().
    6.  */
    7. void myClass::slotTimeout()
    8. {
    9. qDebug("Slot timeout, stopping timer");
    10. mTimer->stop(); // stop timer if it isn't already
    11. emit sigTimeout();
    12. }
    To copy to clipboard, switch view to plain text mode 

    So I'd like for the generated HTML documentation for this function to have the "sigTimeout()" as a hyperlink that takes the reader back to the signal documentation. Right now it just shows up as plain text.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,311
    Thanks
    314
    Thanked 870 Times in 857 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: What Doxygen tag should I use when a function emits a signal?

    I don't know if there is a Qt signal-specific tag. I'm not a doxygen guru. I usually use the "see also" (sa) tag followed by the name of the signal.

    Apparently there are some Qt-specific tags, because you see things like "[signal]" in Qt documentation. Maybe the best way is to find a bit of Qt documentation that looks like what you want, then search the source code to see how it is tagged.

  3. #3
    Join Date
    Oct 2012
    Posts
    132
    Thanks
    10
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: What Doxygen tag should I use when a function emits a signal?

    How is the signal declared (did you really use the uncommon "sig"-prefix)? Prints doxygen any error messages?

    Normally doxygen should be able to detect signals proberly. You can document signals itself like you would document pure virtual methods (using "\fn ..."). Does this work?

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,311
    Thanks
    314
    Thanked 870 Times in 857 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: What Doxygen tag should I use when a function emits a signal?

    I think the OP is asking how to document the fact that a function emits a signal, not the declaration of the signal itself.

  5. #5
    Join Date
    Jan 2014
    Posts
    36
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: What Doxygen tag should I use when a function emits a signal?

    I think the OP is asking how to document the fact that a function emits a signal, not the declaration of the signal itself.
    Correct. Doxygen is properly documenting the signal itself in the section normally reserved for signals. But I'm trying to document a different function of mine that emits the given signal. In that function's documentation, I want the name of the signal to be a link that takes the user back to the documentation of the signal itself.

    So:
    Qt Code:
    1. signals:
    2. /**
    3.   * @brief Bar signal
    4.   *
    5.   * This signal is a useful signal
    6.   */
    7. void sigBar();
    8.  
    9. public:
    10. /**
    11.   * @brief Foo function
    12.   *
    13.   * This function does all sorts of miraculous things. Oh, and it emits sigBar()
    14.   */
    15. void foo();
    To copy to clipboard, switch view to plain text mode 

    So I want the "sigBar()" text in the documentation for the foo function to be clickable. It seems like there should be some doxygen tag I add on line 13, before sigBar(), that tells doxygen to link that text back. Right now, it's just plain text.

    I don't know if there is a Qt signal-specific tag. I'm not a doxygen guru. I usually use the "see also" (sa) tag followed by the name of the signal.
    I'll try this and see what happens!


    Added after 4 minutes:


    I think the OP is asking how to document the fact that a function emits a signal, not the declaration of the signal itself.
    Correct. Doxygen is properly documenting the signal itself in the section normally reserved for signals. But I'm trying to document a different function of mine that emits the given signal. In that function's documentation, I want the name of the signal to be a link that takes the user back to the documentation of the signal itself.

    So:
    Qt Code:
    1. signals:
    2. /**
    3.   * @brief Bar signal
    4.   *
    5.   * This signal is a useful signal
    6.   */
    7. void sigBar();
    8.  
    9. public:
    10. /**
    11.   * @brief Foo function
    12.   *
    13.   * This function does all sorts of miraculous things. Oh, and it emits sigBar()
    14.   */
    15. void foo();
    To copy to clipboard, switch view to plain text mode 

    So I want the "sigBar()" text in the documentation for the foo function to be clickable. It seems like there should be some doxygen tag I add on line 13, before sigBar(), that tells doxygen to link that text back. Right now, it's just plain text.

    I don't know if there is a Qt signal-specific tag. I'm not a doxygen guru. I usually use the "see also" (sa) tag followed by the name of the signal.
    I'll try this and see what happens!

    I think the OP is asking how to document the fact that a function emits a signal, not the declaration of the signal itself.
    Correct. Doxygen is properly documenting the signal itself in the section normally reserved for signals. But I'm trying to document a different function of mine that emits the given signal. In that function's documentation, I want the name of the signal to be a link that takes the user back to the documentation of the signal itself.

    So:
    Qt Code:
    1. signals:
    2. /**
    3.   * @brief Bar signal
    4.   *
    5.   * This signal is a useful signal
    6.   */
    7. void sigBar();
    8.  
    9. public:
    10. /**
    11.   * @brief Foo function
    12.   *
    13.   * This function does all sorts of miraculous things. Oh, and it emits sigBar()
    14.   */
    15. void foo();
    To copy to clipboard, switch view to plain text mode 

    So I want the "sigBar()" text in the documentation for the foo function to be clickable. It seems like there should be some doxygen tag I add on line 13, before sigBar(), that tells doxygen to link that text back. Right now, it's just plain text.

    I don't know if there is a Qt signal-specific tag. I'm not a doxygen guru. I usually use the "see also" (sa) tag followed by the name of the signal.
    I'll try this and see what happens!

    I think the OP is asking how to document the fact that a function emits a signal, not the declaration of the signal itself.
    Correct. Doxygen is properly documenting the signal itself in the section normally reserved for signals. But I'm trying to document a different function of mine that emits the given signal. In that function's documentation, I want the name of the signal to be a link that takes the user back to the documentation of the signal itself.

    So:
    Qt Code:
    1. signals:
    2. /**
    3.   * @brief Bar signal
    4.   *
    5.   * This signal is a useful signal
    6.   */
    7. void sigBar();
    8.  
    9. public:
    10. /**
    11.   * @brief Foo function
    12.   *
    13.   * This function does all sorts of miraculous things. Oh, and it emits sigBar()
    14.   */
    15. void foo();
    To copy to clipboard, switch view to plain text mode 

    So I want the "sigBar()" text in the documentation for the foo function to be clickable. It seems like there should be some doxygen tag I add on line 13, before sigBar(), that tells doxygen to link that text back. Right now, it's just plain text.

    I don't know if there is a Qt signal-specific tag. I'm not a doxygen guru. I usually use the "see also" (sa) tag followed by the name of the signal.
    I'll try this and see what happens!

    I think the OP is asking how to document the fact that a function emits a signal, not the declaration of the signal itself.
    Correct. Doxygen is properly documenting the signal itself in the section normally reserved for signals. But I'm trying to document a different function of mine that emits the given signal. In that function's documentation, I want the name of the signal to be a link that takes the user back to the documentation of the signal itself.

    So:
    Qt Code:
    1. signals:
    2. /**
    3.   * @brief Bar signal
    4.   *
    5.   * This signal is a useful signal
    6.   */
    7. void sigBar();
    8.  
    9. public:
    10. /**
    11.   * @brief Foo function
    12.   *
    13.   * This function does all sorts of miraculous things. Oh, and it emits sigBar()
    14.   */
    15. void foo();
    To copy to clipboard, switch view to plain text mode 

    So I want the "sigBar()" text in the documentation for the foo function to be clickable. It seems like there should be some doxygen tag I add on line 13, before sigBar(), that tells doxygen to link that text back. Right now, it's just plain text.

    I don't know if there is a Qt signal-specific tag. I'm not a doxygen guru. I usually use the "see also" (sa) tag followed by the name of the signal.
    I'll try this and see what happens!


    Added after 18 minutes:


    Well, I'm not entirely sure what I did, but now it appears to be working. It's possible that when I tried it before, I may not have actually documented the signal? Right now I just have:
    Qt Code:
    1. /**
    2.   * @brief Connection timeout signal
    3.   *
    4.   * Emitted whenever the connection timer times out.
    5.   */
    6. void sigTimeout();
    7.  
    8.  
    9. /**
    10.  * @brief Called when timer times out
    11.  *
    12.  * This function is called when the timer times out.
    13.  * Emits sigTimeout().
    14.  */
    15. void myClass::slotTimeout()
    16. {
    17. qDebug("Slot timeout, stopping timer");
    18. mTimer->stop(); // stop timer if it isn't already
    19. emit sigTimeout();
    20. }
    To copy to clipboard, switch view to plain text mode 
    And the documentation for slotTimeout() is correctly linking back to the signal sigTimeout(). Sorry for the noise if that was the problem!
    Last edited by SeanM; 25th September 2014 at 15:43.

Similar Threads

  1. Replies: 2
    Last Post: 26th October 2013, 05:40
  2. QProcess finishes but never emits finished signal
    By BettaUseYoNikes in forum Qt Programming
    Replies: 2
    Last Post: 3rd December 2011, 08:01
  3. Passing pointer to object that emits a signal
    By Gadgetman53 in forum Qt Programming
    Replies: 2
    Last Post: 17th April 2011, 21:04
  4. Replies: 3
    Last Post: 2nd April 2011, 13:13
  5. Replies: 4
    Last Post: 23rd January 2011, 10:08

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.