Results 1 to 3 of 3

Thread: Use Code Model in QT creator plugin

  1. #1
    Join Date
    Jan 2020
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Use Code Model in QT creator plugin

    Hi,
    I'm trying to write a plugin for Qt creator that lists the functions that are declarated in a '.c' or '.h' file. I'm doing this to speed up the useless practise required by my company to list in the header of each file the list of exported and internal functions.
    I have written several plugin for Qt creator, but this is the first time I need the code model. I'd rather NOT to use CLang code model.

    I have tried calling in a loop the function "CPlusPlus:ocument::functionAt" but this only finds implemented functions; for me it's required to also include function prototypes of header files.

    Then I have tried with CPlusPlus:ocument::scopeAt, looping the member of the full file scope. Here the problem is that CPlusPlus::Symbol::asDeclaration does not make any difference between functions declaration and file scope variable declarations.

    Any idea about how to isolate function declarations?

    Thank you

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Use Code Model in QT creator plugin

    Any idea about how to isolate function declarations?
    If CPlusPlus:: Symbol:: asDeclaration returns all declarations in a header file, then you should be able to distinguish between variables and functions by looking for a pair of parentheses, no?
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Jan 2020
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Use Code Model in QT creator plugin

    Quote Originally Posted by d_stranz View Post
    If CPlusPlus:: Symbol:: asDeclaration returns all declarations in a header file, then you should be able to distinguish between variables and functions by looking for a pair of parentheses, no?
    Actually CPlusPlus:: Symbol is an object from which I can extract the 'nameId' (which never contains parentheses), but I can't retrieve the full signature.

Similar Threads

  1. Replies: 10
    Last Post: 16th June 2014, 16:40
  2. Replies: 19
    Last Post: 12th June 2014, 08:30
  3. Replies: 2
    Last Post: 11th June 2014, 09:17
  4. Replies: 1
    Last Post: 14th February 2014, 09:36
  5. Qt Creator qt creator code model
    By Vanir in forum Qt Tools
    Replies: 0
    Last Post: 5th October 2010, 12:10

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.