ProjectItem vs. ProjectFolderItem

Andreas Pakulat apaku at gmx.de
Sun Sep 30 14:33:33 UTC 2007


On 30.09.07 09:03:28, Matt Rogers wrote:
> On Sunday 30 September 2007 04:51:02 am Andreas Pakulat wrote:
> > Hi,
> >
> > as Aleix pointed out its currently quite ugly to create custom
> > ProjectItem's for your buildmanager. The reason is that you'd have to
> > subclass KDevelop::ProjectItem+<custom folder item> resulting in this:
> >
> > class QMakeProjectItem : public ProjectItem, QMakeFolderItem
> > {
> > };
> >
> > The reason why this is ugly because the inheritance graph for this is
> > now:
> >
> >              ProjectFolderItem
> >
> >           ----------+-------------
> >
> >    QMakeFolderItem         ProjectItem
> >
> >           ----------+-------------
> >
> >              QMakeProjectItem
> >
> > (not 100% correct, I left out the ProjectBuildFolderItem)
> >
> > So we have that dreaded diamond-shape inheritance :(
> >
> 
> Why do we have ProjectItem to begin with? Is there some reason we can't just 
> add an isProjectRoot() function to ProjectFolderItem?

See Aleix answer, the reason is currently that for a project item the
text in the view is the projects name instead of the path of the folder
like for normal folder items.

So we could do what you propose, but in that case setProjectRoot( bool )
would do a setText( project()->name() ) behind the scenes. If thats ok,
then yes thats a good solution of the problem.

Andreas

-- 
Another good night not to sleep in a eucalyptus tree.




More information about the KDevelop-devel mailing list