Re: [Interest] Awkwardness of delegates in heterogenous ListViews

2016-06-09 Thread Michael Brasser
org Interest Subject: [Interest] Awkwardness of delegates in heterogenous ListViews Hi all, I'm currently using a "type" role in my items and then a Loader as delegate, to give a level of indirection and let me choose the actual delegate based on the "type" of the item.

Re: [Interest] Awkwardness of delegates in heterogenous ListViews

2016-06-09 Thread Jason H
> And as soon as I said that, I realize that this solution is bust: I > can't use the visible/invisible trick since the various delegates will > then make illegal uses of the items. I must use the Loader approach. > But if I use the loader approach, then my solution with propagating > the

Re: [Interest] Awkwardness of delegates in heterogenous ListViews

2016-06-09 Thread Elvis Stansvik
} >>>> Text { >>>> id: flagDelegate >>>> text: value + " (flag)" >>>> visible: type === "flag" >>>> } >>>> Text { >&

Re: [Interest] Awkwardness of delegates in heterogenous ListViews

2016-06-09 Thread Elvis Stansvik
; } >>> } >>> } >>> >> >> It does not really solve the "problem" though. Say one of my delegates >> is a ColorDelegate for when the item represents a color, and I want to >> provide editing (my model has a setColor(index, color)).

Re: [Interest] Awkwardness of delegates in heterogenous ListViews

2016-06-09 Thread Elvis Stansvik
odel.setColor(index, > color), thereby tying the color delegate to this way of working: It It seems there is actually something called just "model" available in the delegate and its children, but it's of type QQmlDMAbstractItemModelData, and I get a TypeError if trying to treat it as my cu

Re: [Interest] Awkwardness of delegates in heterogenous ListViews

2016-06-09 Thread Elvis Stansvik
of the view, and to do that I have to use parent.ListView.view.width, thus assuming that the parent is the real delegate. It would have been convenient if the view itself was directly accessible in the delegate and its children, in the same way as the index is, instead of as an attached property on

Re: [Interest] Awkwardness of delegates in heterogenous ListViews

2016-06-09 Thread Elvis Stansvik
to consist of only colors (well not without artificially nesting it inside something else, like an invisible Rectangle, so that the reference to setColor works). On the C++ side, it's a bit easier to make delegates that are reusable in these two situations, since you work with createEditor and friends

Re: [Interest] Awkwardness of delegates in heterogenous ListViews

2016-06-08 Thread Elvis Stansvik
ind id "parent" > > And this would still tie my "subdelegates" to this structure. They could not > be reused in other places, where lists are homogenous and I'm not using the > Loader approach. > > But I guess there's really no way to make a delegate that can be used i

Re: [Interest] Awkwardness of delegates in heterogenous ListViews

2016-06-08 Thread Jason H
ssage- > From: Interest [mailto:interest-bounces+even.kristoffersen=honeywell@qt-project.org] On Behalf Of Elvis Stansvik > Sent: 8. juni 2016 15:34 > To: interest@qt-project.org Interest <interest@qt-project.org> > Subject: Re: [Interest] Awkwardness of delegates in heterogenous

Re: [Interest] Awkwardness of delegates in heterogenous ListViews

2016-06-08 Thread Elvis Stansvik
oneywell@qt-project.org] On Behalf Of Elvis Stansvik > Sent: 8. juni 2016 15:34 > To: interest@qt-project.org Interest <interest@qt-project.org> > Subject: Re: [Interest] Awkwardness of delegates in heterogenous ListViews > > 2016-06-08 15:32 GMT+02:00 Elvis Stansv

Re: [Interest] Awkwardness of delegates in heterogenous ListViews

2016-06-08 Thread Gian Maxera
> On 8 Jun 2016, at 14:32, Elvis Stansvik wrote: > > Hi all, > > I'm currently using a "type" role in my items and then a Loader as > delegate, to give a level of indirection and let me choose the actual > delegate based on the "type" of the item. > > This explains it

Re: [Interest] Awkwardness of delegates in heterogenous ListViews

2016-06-08 Thread Elvis Stansvik
2016-06-08 15:32 GMT+02:00 Elvis Stansvik : > Hi all, > > I'm currently using a "type" role in my items and then a Loader as > delegate, to give a level of indirection and let me choose the actual > delegate based on the "type" of the item. > > This explains it better (from my

[Interest] Awkwardness of delegates in heterogenous ListViews

2016-06-08 Thread Elvis Stansvik
Hi all, I'm currently using a "type" role in my items and then a Loader as delegate, to give a level of indirection and let me choose the actual delegate based on the "type" of the item. This explains it better (from my ListView): delegate: Loader { sourceComponent: {