[Development] parented_ptr

Ville Voutilainen ville.voutilainen at gmail.com
Thu Nov 6 23:50:02 CET 2025


On Fri, 7 Nov 2025 at 00:34, Ville Voutilainen
<ville.voutilainen at gmail.com> wrote:
>
> On Thu, 6 Nov 2025 at 16:39, Volker Hilsheimer <volker.hilsheimer at qt.io> wrote:
> > As the mailing list doesn’t make for a great code review experience: https://codereview.qt-project.org/c/qt/qtbase/+/689322
> >
> > Good catch with QWindow (and possibly other types for which we explictly overload setParent to require something else than QObject *); QGraphicsItem is not a QObject.
>
> I know that QGraphicsItem is not a QObjct, but previous descriptions
> of this function also didn't SFINAE away QObject-*non*-derivates. :D

..and to make it clearer what I mean, you can try to do

someQObject->makeChild<SomeGraphicsItem>();

and that won't compile, but you need to decide what quality of
diagnostic you want to give it.

And maybe QGraphicsItem should have its own makeChild(), too.


More information about the Development mailing list