Results 1 to 16 of 16

Thread: how to document classes and member functions?

  1. #1
    Join Date
    Mar 2011
    Posts
    13
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default how to document classes and member functions?

    I'm having problems with writing documentations for my classes and their member functions. I've found what I want in Qt base classes. Here are several rows from "QVector.cpp":
    Qt Code:
    1. /*!
    2.   \class QVector
    3.   \brief The QVector class is a template class that provides a dynamic array.
    4.  
    5.   \ingroup tools
    6.   \ingroup shared
    7.  
    8.   \reentrant
    9.  
    10.   QVector\<T\> is one of Qt's generic \l{container classes}. It
    11.   stores its items in adjacent memory locations and provides fast
    12.   index-based access.
    13.  
    14.   QList\<T\>, QLinkedList\<T\>, and QVarLengthArray\<T\> provide
    15.   similar functionality. Here's an overview:
    16.  
    17.   \list
    18.   \i For most purposes, QList is the right class to use. Operations
    19.   like prepend() and insert() are usually faster than with
    20. ..........
    21. */
    22.  
    23. /*!
    24.   \fn QVector<T> QVector::mid(int pos, int length = -1) const
    25.  
    26.   Returns a vector whose elements are copied from this vector....
    27.   .........
    28. */
    29. // ....
    To copy to clipboard, switch view to plain text mode 


    When I'm trying to do the same in my ".cpp" files, nothing happens (hovering the functions' calls in other files doesn't show my documentation). I tried to find some documentation about this and the keywords (tags) as well (like "\class", "\brief", "\ingroup"...), but I couldn't find anything. Can anyone help or give any links to documentation concerning this?
    Last edited by jackal; 4th April 2011 at 13:37.

  2. #2
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to document classes and member functions?

    HI,

    Qt uses doxygen for documenting the code.

    See here for details.
    A camel can go 14 days without drink,
    I can't!!!

  3. The following user says thank you to mcosta for this useful post:

    jackal (4th April 2011)

  4. #3
    Join Date
    Mar 2011
    Posts
    13
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to document classes and member functions?

    Quote Originally Posted by mcosta View Post
    Qt uses doxygen for documenting the code.
    Yes, that's very good solution for me. But my main problem is to make Qt Creator to show my brief descriptions when hovering the described functions or other members. It's useful for others to view it exactly in the cpp files, while working on those.

  5. #4
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to document classes and member functions?

    Read here to integrate your doc into QtAssistant.

    I think QtCreator uses it
    A camel can go 14 days without drink,
    I can't!!!

  6. #5
    Join Date
    Mar 2011
    Posts
    13
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to document classes and member functions?

    According to what I've found there, it's possible to create a custom documentation and register it in both Qt Creator and Assistant. But it's not project-based. It's hard and boring work witch is useful for types that can be used in any project. All I wanna do is to describe each project's parts (classes, variables, functions...) individually.

  7. #6
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to document classes and member functions?

    If you want use Qt Creator, you must use Assistant integration.

    I think this is not so hard and can be usefull for developing big projects.
    A camel can go 14 days without drink,
    I can't!!!

  8. #7
    Join Date
    Mar 2011
    Posts
    13
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to document classes and member functions?

    Quote Originally Posted by mcosta View Post
    I think this is not so hard and can be usefull for developing big projects.
    Agree, but in any job there will always be types that have the same name, but different purposes in different projects (I'm talking about small classes, that doesn't mean to be used everywhere with same functionality). I'm almost sure there will be solutions for cases like this: to create fast, small, project-depended documentation (like with doxygen, but integrated in Qt Creator for specific project only).
    Anyway, your help was very useful. Thank you very much! If I find smth about this in future, I'll post it here for everyone.

  9. #8
    Join Date
    Mar 2011
    Posts
    13
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to document classes and member functions?

    Problem partly solved!

    To use your own documentation in Qt Assistant (and in Qt Creator help as well) you need to create Qt Compressed Help file (.qch) and register it in Assistant and Creator.
    Doxygen has several tools exactly for Qt. There are tags in it's config file, that help you to create the documentation exactly the way you need. E.g. with GENERATE_QHP tag you can make it create the ready qhp (Qt Help Project) file (you need this to generate the .qch). If you don't need to edit this file manually before creating the .qhc, you can set the value of QHG_LOCATION tag to the location of your qhelpgenerator.exe (usually it's here (in Windows): <QtPath>/mingw/bin/qhelpgenerator.exe) and it will generate the ready documentation. Register it in Qt Assistant (optional) and Creator and you're done.
    After this all your documented types, functions, members, etc. will have the tooltip with F1 button hint. And of course pushing F1 will show your documented help for it.

    Now the only problem remaining is to make Qt Creator to show also the brief descriptions. I've tried a lot but useless.. If anyone have an idea, please tell me.

  10. #9
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to document classes and member functions?

    Have you used "QT_AUTOBRIEF"???
    A camel can go 14 days without drink,
    I can't!!!

  11. #10
    Join Date
    Mar 2011
    Posts
    13
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to document classes and member functions?

    Quote Originally Posted by mcosta View Post
    Have you used "QT_AUTOBRIEF"???
    Yes, it didn't help

  12. #11
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to document classes and member functions?

    ok, I think this is a question for Qt Creator gurus (developer)
    A camel can go 14 days without drink,
    I can't!!!

  13. #12
    Join Date
    Mar 2011
    Posts
    13
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to document classes and member functions?

    Quote Originally Posted by mcosta View Post
    Qt Creator gurus (developer)
    are there any in this forum?

  14. #13
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to document classes and member functions?

    I don't think Qt supports project-specific help whilst you type, but there are IDEs that do, such as Netbeans, Visual Studio (with plugin) and possibly Eclipse. Netbeans being my current favorite, free, open source and easily extendable with Java.

  15. The following user says thank you to squidge for this useful post:

    jackal (8th April 2011)

  16. #14
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to document classes and member functions?

    I saw Qt Creator code and I understand (I hope) that it uses the index.
    A camel can go 14 days without drink,
    I can't!!!

  17. #15
    Join Date
    Mar 2011
    Posts
    13
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to document classes and member functions?

    Thank you for your help, guys! I think it's good idea to try Netbeans (I don't want new headaches about this any more right now). After I finish my current project, I'll try to find some solution to use native tooltips of Qt Creator. I'll let you know if I have any success.

  18. #16
    Join Date
    Mar 2011
    Posts
    13
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to document classes and member functions?

    Quote Originally Posted by jackal View Post
    I think it's good idea to try Netbeans
    NOPE! I didn't like it
    Qt Creator is really good. Don't wanna try another editor

Similar Threads

  1. Replies: 1
    Last Post: 16th March 2011, 08:10
  2. Replies: 5
    Last Post: 17th November 2010, 17:29
  3. Question about functions in classes
    By cwnelatury in forum Newbie
    Replies: 1
    Last Post: 13th May 2009, 06:05
  4. Pointers to Member Functions
    By Doug Broadwell in forum General Programming
    Replies: 8
    Last Post: 15th May 2007, 23:08
  5. emiting signals from const member functions !?
    By sunil.thaha in forum Qt Programming
    Replies: 2
    Last Post: 25th March 2006, 11:29

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.