[Qt-creator] Extract call graph from QtCreator

Nikolai Kosjar nikolai.kosjar at digia.com
Mon Oct 14 09:47:47 CEST 2013


Hi!

On 10/14/2013 04:37 AM, 欧三股四 wrote:
> Hello all, I want to extend QtCreator so that it can display the call
> graph of a project.

Please define "call graph of a project". I assume this is supposed to 
contain all callers and callees for each function in a project? Why not 
just a call graph for a particular function?

> I downloaded the source code but just found that it
> was so complicated. I traced the call hierarchy several times but
> couldn't found what I need. So can anyone tell me:
>
> (1) How can I extract all Classes in a project ?

I would have expected you to ask for all functions in a project...

Check CppLocatorData::classes() and CppLocatorData::functions().

Once indexing/parsing is finished, these will return you the data about 
all classes / functions that were parsed, which is not limited to 
projects. ModelItemInfo::fileName and 
CppModelManagerInterface::projectInfos() can help you to filter the 
unrelated out.

> (2) How to get all references of a symbol (for example: a function) ?

Have a look at CPPEditorWidget::findUsages() ...which boils down to 
CppFindReferences::findUsages().

Nikolai




More information about the Qt-creator mailing list