[Development] The future of smart pointers in Qt API

Vitaly Fanaskov vitaly.fanaskov at qt.io
Fri Jan 31 16:27:29 CET 2020

Not abandoning, I think, but re-implementing properly. Raw pointers 
cause some certain problems here and changing them to something more 
smart would be nice. But it doesn't mean that we should get rid of 
parent-child model entirely. The point is that we can make it more 
explicit just by using smart pointers.

To make it clear, there is no decision made. We're just discussing.

On 1/31/20 4:13 PM, Eric Lemanisser wrote:
> Are we really considering abandoning the parent-child ownership for
> qt6 ? that would be a huge breaking change
>> > I would like to separate pointers with simple ownership and complicated > ownership. We could solve passing of raw pointers with simple ownership > first using standard smart pointers. Where as the more complicated pointers > would require special classes like those Daniel Teske has been working on. I'm not sure how to properly identify what is the "complicated ownership". I don't think that there are places in Qt API where we really need something more complicated than regular shared/weak/unique pointers. Even intrusive pointers are not required I guess. When you think about something more complicated, this is probably an architectural problem (like with parent-child) or bad API design. Can you provide some real examples where we need something more complicated than regular smart pointers, please?

Best Regards,

Fanaskov Vitaly
Senior Software Engineer

The Qt Company / Qt Quick and Widgets Team

More information about the Development mailing list