New ProjectModel implementation
apaku at gmx.de
Wed Jun 30 15:44:12 UTC 2010
On 30.06.10 16:16:45, Aleix Pol wrote:
> On Sun, Jun 27, 2010 at 3:02 PM, Andreas Pakulat <apaku at gmx.de> wrote:
> > just to let you know, I've just merged the rewrite of the projectmodel
> > API I've worked on into master. Its now indepdenent of any GUI
> > dependencies and doesn't use QStandardItemModel anymore but custom
> > items. This also allowed to minimize the API a bit and make it more
> > specific (a real rename function instead of some hidden way of using
> > setData).
> > I couldn't see any regressions and we do have a quite good unit-test for
> > it too. (it covers around 60% currently IIRC).
> > It'll hopefully also make it easier to change the actual implementation
> > to a ref-counted version or something other. I'm not sure thats really
> > necessary though, it should be enough if places that do store
> > item-pointers also listen to model-signals to find out wether their item
> > is deleted and then remove it from their internal storage.
> I've seen that there's some inconsistency with the model naming now.
> When the project is imported for the first time i get a root item called
> "KDevelop" (for example) and the next times it's called "kdevelop" (lower
> case). It's kind of annoying because whatever you configure with project
> model paths gets broken.
Hmm, why is it called KDevelop first? Do you use a setText call
somewhere? ProjectFolderItem uses the last part of the url as text
whenever the url is being provided (i.e. setUrl or constructor).
I guess we could introduce a new item type "ProjectRootItem" that is a
ProjectFolderItem subclass and uses project()->name() for text() instead
That solution would have the benefit of also creating a more robust way
of checking wether a given item is a root-level item (as parent() also
returns 0 if its just been created and not attached to a parent yet).
This life is yours. Some of it was given to you; the rest, you made yourself.
More information about the KDevelop-devel