[Qt-creator] Adding projects to session

Ziller Eike Eike.Ziller at theqtcompany.com
Thu Feb 5 10:41:08 CET 2015


> On Feb 4, 2015, at 7:11 PM, Андрей Полтавец <andrey.poltavets at gmail.com> wrote:
> 
> Hi QtC devs! Please help me workaround my trouble.
> I am fully lost in code. I wrote own project format and trying to add files to current session. Now I bushed at 100%. :)
> 
> Where is right point to start? Now I have unworking code like this:
> 
> project = ProjectExplorer::ProjectExplorerPlugin::instance()->openProject(*projectFilename, &er); //yeah, i have "QString * projectFilename;"
> ProjectExplorer::SessionManager::instance()->sessionNode()->addProjectNodes(QList<ProjectExplorer::ProjectNode *>() << project->rootProjectNode());

You

- register a mime type for your project files (if there is none already), look for calls of Core::MimeDatabase::addMimeTypes for examples
- write an implementation of IProjectManager and add an instance of it to the global object pool (e.g. PluginManager::addObject)
- your project manager’s mimeType method must return the name of the mime type you registered for your project files
- your project manager’s openProject method must return a Project subclass instance for your project type
- write an implementation of Project for this. beside other things your Project implementation has to return a rootProjectNode for your project, which is automatically added to the project tree widget

A sensible way to learn how all this works is probably to have a look at how GenericProjectManager or QmlProjectManager work, since these are relatively simple

Br, Eike

> Please correct it for successfully adding my project.
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator

-- 
Eike Ziller, Senior Software Engineer - The Qt Company GmbH
 
The Qt Company GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B



More information about the Qt-creator mailing list