[Qt-creator] Class Browser

roberto.raggi at nokia.com roberto.raggi at nokia.com
Thu Nov 5 11:38:30 CET 2009


Hi Damien,

On Nov 5, 2009, at 11:21 AM, ext Damien Fagnou wrote:

> Hi ,
>
> Thanks for your reply ,
>
> at the moment this is really only targeted for internal use so memory
> and speed are not a priority .
> if I wanted to have a go at the (not ideal) solution you recommend
> ("visit of the global symbol tables") were would I look ?

Look at src/libs/cplusplus/OverviewModel.{h,cpp} it provides the data  
model for the overview browser (the combobox that show the methods of  
the current file). OverviewModel in used in plugins/cppeditor/ 
cppeditor.cpp, search for m_overviewModel.

You can get the global symbol tables with something like

#include <cppmodelmanagerinterface.h>

using namespace CppTools;
using namespace CPlusPlus;

// get a pointer to the model manager interface.
CppModelManagerInterface  *modelManager =  
CppModelManagerInterface::instance();

const Snapshot snapshot  = modelManager->snapshot();

foreach (Document::Ptr doc, snapshot) {
    Namespace *globalNamespace = doc->globalNamespace();
    // ### do something with globalNamespace here.
}

>
> Thanks a lot for bringing a first class IDE into the linux(cross
> platform) world !

:)

ciao robe





More information about the Qt-creator-old mailing list