On Tue, 4 Nov 2025 at 13:07, Daniel Schürmann <[email protected]> wrote:
> if you want an universal:
>
> parent->createChild<QLabel>();
>
> It is possible with C++23 and if we assume that either the fist or the last 
> parameter is the parent.
> Quite cumbersome. I would like to postpone this for now.
>
> Does that make sense?

Sure, it makes sense to postpone the idea of such a universal thing.

But while doing that, I think it continues to make perfect sense to
have a less-universal version of it.

new Child(parent);

looks very weird, and

parent->createChildObject<Child>();

would be quite an improvement.

And QParentedPointer can still be universal, because it would just
assert the same p->parent() for multiple
different types, even if those parents are of different types.
-- 
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development

Reply via email to