[Interest] QWeakPointer in Qt5

Philippe philwave at gmail.com
Fri Jun 22 13:22:00 CEST 2012


That's good news indeed. I'm a fan of these Qt pointer classes.

Philippe

On Wed, 20 Jun 2012 08:27:57 +0200
Thiago Macieira <thiago.macieira at intel.com> wrote:

> On quarta-feira, 20 de junho de 2012 06.42.52, Philippe wrote:
> > In Qt 5 in git, I have seen changes to this implementation. Mainly, in
> > Qt 4.8, it was stated that "QWeakPointer serves as a replacement to
> > QPointer". This is no longer the case and this is mentionned as
> > deprecated (qsharedpointer.cpp).
> > 
> > QWeakPointer was quoted in 4.8 as "more efficient than QPointer, so it
> > should be preferred in all new code.".
> > 
> > I use it a lot without trouble. So I would like to know why this (apparent)
> > regression?
> > 
> > Question for Thiago I guess...
> 
> Yes, I need to blog about this (I have a draft actually).
> 
> In Qt5, QPointer and QWeakPointer are equally efficient. However, we've split 
> the usages:
> 
>  - QPointer when you want to use to track QObjects, just like original Qt 4.0
>  - QWeakPointer when you want to track a QSharedPointer
> 
> The QWeakPointer constructor that takes a QObject is deprecated.
> -- 
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel Open Source Technology Center
>      Intel Sweden AB - Registration Number: 556189-6027
>      Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden





More information about the Interest mailing list