On Tue, Nov 4, 2025 at 6:00 AM <[email protected]> wrote:

> I don't think we should strive for an API that requires separate steps
> for creating a child and setting its
> parent, I think it's better if our API (and how it works internally)
> just creates children with a parent argument.
> There's all kinds of types in Qt that end up doing a whole lot of
> pointless work if they're first created without
> a parent and then separately reparented.

Agreed.  In fact, when you make a Q class it starts with a default argument
of nullptr in the constructor. I think it would be better without that (we
routinely remove it). That way, if you don't want a parent for whatever
reason, the constructor will show a nullptr argument. It makes the
parentage clearer.

Right now if you forget the parent when constructing a GUI object, you get
a button or whatever dangling in space.  But anything else will just leak
silently.

Casey McDermott
TurtleSoft.com
-- 
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development

Reply via email to