[Interest] What's the recommended way to put QObjects in smart pointers?
Nikos Chantziaras
realnc at gmail.com
Thu May 5 03:24:48 CEST 2016
On 04/05/16 21:35, Thiago Macieira wrote:
> On quarta-feira, 4 de maio de 2016 20:56:52 PDT Nikos Chantziaras wrote:
>> From what I can tell, QPointer does not delete the object, so that's a
>> no go.
>>
>> Putting the objects on the stack doesn't work either, because the Qt
>> object model does not support that (it will call 'delete' on the object
>> even if it's on the stack.)
>
> So what are you requirements? Do you want to a container that does delete the
> object it has, unless the parent has already deleted it?
Well, basically what I want is not having even a single 'new' or
'delete' anywhere in my code. I already achieved that with all my non-Qt
projects.
By now, I consider application-level code that uses 'new' or 'delete' as
bogus and in need of fixing.
More information about the Interest
mailing list