[Development] Development Digest, Vol 170, Issue 4
TurtleSoft Support
support at turtlesoft.com
Tue Nov 4 14:33:38 CET 2025
On Tue, Nov 4, 2025 at 6:00 AM <development-request at qt-project.org> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20251104/bc41e168/attachment.htm>
More information about the Development
mailing list