>       QToolButton * downb = new QToolButton(qp, _("Down"), "",
>                                             this, SLOT(down()), this);
>       downb->show();
>
>
> am I right in thinking that this does not leak since the "this" takes
> owenership of the pointer?

Yes, as long as the parent gets deleted (obviously). NB: it's the last 
parameter that's the parent in this case (second this).

> Could we just write this as
>       (new QToolButton(qp, _("Down"), "", this, SLOT(down()),
> this))->show();

Yes, as long as this is valid C++ (for whatever reason I've never tried it).

Cheers, Kuba Ober

Reply via email to