> On 30 Oct 2025, at 18:20, Daniel Schürmann <[email protected]> wrote:
> 
> 3: QObject::addChild(std::unique_ptr<QObject *> child)
> Will this have a chance to being merged upstream?


In principle, I don’t see a reason why this would not be acceptable.

The devil is in the details; note that the following does not compile:

    QObject parent;
    QWidget widget;
    widget.setParent(&parent);

as QWidget::setParent(QWidget *) shadows QObject::setParent(QObject *). The 
equivalent code using addChild

    QObject object;
    auto child = std::make_unique<QWidget>();
    object.addChild(std::move(child));

should also not compile, as a QWidget must only have another widget as the 
parent.

(and thinking about it, that’s also something to keep in mind for 
QObject::makeChildObject).

And all of that without qobject.h being able to include qwidget.h… which might 
make this challenging.

Volker

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

Reply via email to