[Development] unique_ptr and Qt, Take 2

Thiago Macieira thiago.macieira at intel.com
Fri May 3 21:13:56 CEST 2019


On Friday, 3 May 2019 12:04:40 PDT Giuseppe D'Angelo via Development wrote:
> Anyhow, I too feel that we may need a dedicated smart pointer class for
> this, to catch all the corner cases and allow the existing flow of
> 
> 1) create something
> 2) (re)parent it
> 3) keep using that something via a non-owning pointer.

Same here. I think Daniel is on to something and we really should explore 
having smart pointers in Qt 6, but at this point I'm not convinced 
std::unique_ptr alone is it. I'd like to see what we could achieve with a 
QObject-specific smart pointer that understood ownership-taking functions 
(setParent, addWidget, etc.) and observing-only API (like connect()).

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel System Software Products






More information about the Development mailing list