On Monday 16 January 2012 13:48:33 Stephen Kelly wrote:
> On Monday, January 16, 2012 13:21:19 you wrote:
> > On Monday 16 January 2012 02:13:44 Stephen Kelly wrote:
> > [...]
> > 
> > > If QML doesn't re-read the rolenames when the model is reset, then
> > > there's a patch to be made in QtDeclarative. (QAbstractProxyModel
> > > doesn't re-read them on reset either. Ogoffart rejected my patch to
> > > make it do that for reasons which never made sense to me and which I
> > > now forget and can't find on the internet).
> > 
> > I don't recall all the details either, but if I remember correctly, your
> > patch was doing things that were not allowed.
> > The role name feature is a bit broken as you can't really modify them.
> > (As usual with features that are added to Qt in a rush by the
> > decarative team for their own use cases, without much thinking ahead)
> > 
> > The documentation say:
> > "This function allows mapping of role identifiers to role property names
> > in Declarative UI. This function must be called before the model is
> > used. Modifying the role names after the model has been set may result
> > in undefined behaviour."
> > 
> > And you were calling it while the model was already in use, and I think
> > it was the reason why I rejected.
> 
> Yes, I think that was it. Bad documentation IMO. Resetting the model means
> you have to read everything from it from scratch. It is very much well
> enough defined IMO that resetting the model might mean that it has
> different role names.
> 
> > > Anyway the Qt 5.0 way to set rolenames is to implement a virtual
> > > method. Please see if that addresses your concern, and if it
> > > doesn't, then please
> > > write an example which doesn't require a proxy which hides 'multiple
> > > underlying models'. That might not work anyway for various reasons
> > > (if
> > > you are using QAbstractProxyModel). Use an example such as 'a proxy
> > > model which returns a string filename for an image instead of a
> > > QImage
> > > for the decoration role'.
> > 
> > I think Qt 5 still do not implement ways to notify that the role name
> > change.
> 
> Resetting the model means 'everything just changed'. The rolenames are part
> of 'everything'.
> 
> I think all it takes is fixing the documentation for Qt 5 to make that
> clearer for you.

Yes, a change in the documentatin would be enough for the qtbase part.
(ok, maybe some tsts welcome as well)
But declarative also need to be fixed to the fact that roles name can change.



_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to