An Useful Model Proposal : KStringDataListModel

Bruno Virlet bruno.virlet at gmail.com
Fri Mar 2 12:11:45 GMT 2007


On Friday 02 March 2007, David Faure wrote:
> On Friday 02 March 2007, Bruno Virlet wrote:
> > Hello !
> >
> > On Thursday 01 March 2007, David Faure wrote:
> > > > At the risk of asking the obvious: Why not simply use a
> > > > QStandardItemModel?
> > > > [...]
> > >
> > > Hmpf. I admit that I didn't think of doing it that way.
> >
> > I ported my model to use QStandardItemModel. It is actually nicer.
> >
> > Please find the patch attached.
>
> Hmm I think Simon's point was that we don't really need a
> KStringDataListModel class when the applications can just use
> QStandardItemModel directly. But I lack experience with either one to see
> if the application code would look pretty much fine in both cases, or very
> ugly with the latter and very nice with the former, which would be a reason
> to have a custom class indeed.
> However I see that your model also provides moveUp/moveDown, which is
> probably not so obvious to write when using QStandardItemModel directly in
> the app code. Simon, do you agree that this makes a good reason for having
> the class in kdelibs? There are many widgets/dialogs that have
> moveup/movedown functionality, like kedittoolbar etc.

I had a discussion with Michel Hermier who said that the moveUp and moveDown 
where one good reason, but also the fact that my class directly deals with 
strings and variants and hides all the creation of QStandardItem to the user 
(it makes the code more light and clear imho).

Bruno




More information about the kde-core-devel mailing list