On Friday 20 July 2007 10:56 am, Florent Rougon wrote:
> Phil Thompson <[EMAIL PROTECTED]> wrote:
> > Yes, it reflects the Qt behaviour. Models are often shared between views
> > and so (by default) aren't owned by any particular view. If you know
> > there will only ever be one view then make it the parent of the model.
>
> I thought it should be possible to have the views keep a reference to
> their model without "owning" it, as you say. For instance:
>
>   view1.setModel(model)
>
> internally would do 'view1.model = model'
>
> and similarly,
>
>   view2.setModel(model)
>
> internally would do 'view2.model = model', so that 'model' cannot get
> garbage-collected as long as either 'view1' or 'view2' is alive.
>
> What's wrong with this approach?

Because that would become a special case.

Phil
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to