[Development] Moving itemmodels classes to QtCore

Robin Burchell robin+qt at viroteck.net
Tue Nov 22 18:25:07 CET 2011


2011/11/22 Stephen Kelly <stephen.kelly at kdab.com>:
> A replacement API capable of being used for trees would end up just as
> 'hard' as QAIM is if it is to support relevant usecases. The biggest cause
> of the QAIM stuff being hard is the lack of beyond-entry-level documentation
> on how to use it.

I'd disagree that it's entirely just a matter of documentation. QAIM
is really horribly hairy in some places. Look at beginMoveRows'
documentation, and try not to scream out in horror even if you've
implemented models before (it's that complicated thanks to working
around an implementation flaw if memory serves). Now imagine you're
relatively new to implementing models... I personally think that QAIM
is pretty fundamentally flawed, it's far, far too easy to shoot
yourself in the foot, and I'm omitting things like accessing a
blocking resource from a model (which is a rather opaque way to shoot
yourself in the foot, by making your UI completely unresponsive).

I guess I personally just think that QAIM is way too overcomplicated,
and too easy to blow your foot off with. For just a small sample of
the real-world mistakes and problems that crop up that I've seen in
just one class, take a look at commits like:

https://qt.gitorious.org/qt-mobility/contacts/commit/7ba84cdf8e83a14920c1e8ddaf3bb2c28261e5ac
https://qt.gitorious.org/qt-mobility/contacts/commit/f58f148cdec968111fa3f82709af214fca529a4b
https://qt.gitorious.org/qt-mobility/contacts/commit/fc52684b009810af57456f3fe610afd25dcc0337

It might be nice to *try* think how this could be done easier for
trees, and see if you can't come up with an API for the future that
would be a bit harder to explode things with. I don't know. There's
also good convenience APIs for common usecases like QObjectListModel
that I've stumbled across on Gitorious, etc. All good things.

</ramble>

... all that having been said, I'm not religiously against this,
there's an awful lot of code out there using these models (I've
written a lot of it myself), so perhaps moving them isn't such a
terrible idea.



More information about the Development mailing list