Hey Aaron,

2016-02-25 19:23 GMT+01:00 Aarón Bueno Villares <abv15...@gmail.com>:

> Since Wt makes some lifecycle management of its WObjects, I want to know
> if a WAbstractItemDelegate (or any of its derived class of course), can be
> shared between different columns, for example, if the content to be
> rendered is similar, or must each column have its own delegate?
>

Yes, it can.


> My concerns are the following ones:
>
>    *) If I create a WItemDelegate without a parent, does the view became
> the owner of the newly inserted delegated? I assume that, if I used the
> same delegate for more than one column, after the first insertion the
> delegate already has a parent and there is no re-parenting.
>

True.


>
>    *) In such a case of sharing, if the view is destroyed, does the view
> try to delete each delegate for each column, or there's no risk of a
> delegated being destroyed twice?
>

There is no risk: the deleting of the item delegate will be done at the
level of the WObject (parent) deleting any remaining children WObjects when
it itself gets deleted.


> In conclusion, is it safe to use a same delegate object for more than one
> column? and even for different views?
>

Yes and yes.

Regards,
koen

PS questions like these should be solved when we release wt4 -- which
adopts standard c++11 pointers (std::unique_ptr<> and std::shared_ptr<> and
non-owning raw pointers) in the API. In this case, an item delegate is a
shared_ptr<>.
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to