[MeeGo-touch-dev] MList takes ownership of cell creator

Zhao, Forrest forrest.zhao at intel.com
Mon Aug 16 18:14:15 PDT 2010


Sergiy.Dubovik at nokia.com wrote:
> Hello,
> 
> A month ago I changed documentation of MList::setCellCreator so that
> it now grabs ownership of cell creator. 
> We will implement the actual change quite soon (may be in a week).
> The reason for that is simple: it's not obvious to find a spot where
> to delete cell creator.  
> MList can be deleted with QObject parent-child mechanism, and most of
> developers follow that patter since it's easier to write something
> like this:  
> 
> MList * list = new MList(centralWidget());
> 
> or when your layout takes ownership...Anyhow, managing cell creator
> life is not easy because of the abstraction, you never know when
> centralWidget() for instance will be deleted. So please, if you write
> something like this:   
> 
> list->setCellCreator(this);
> 
> refactor it into it's own class.

I'm not sure if I fully understand the new approach. The below is the code piece in my application.
......
    list = new MList(this);
    itemCreator = new AlbumItemCreator();
    list->setCellCreator(itemCreator);
    model = new AlbumsListModel(nmmPerformer);
    list->setItemModel(model);
    listLayout->addItem(list);
......

What do I need to change to adapt to the new approach?

Thanks,
Forrest


More information about the MeeGo-touch-dev mailing list