[Qt-interest] Question regarding pointer parameters in functions
Patric
userqt at gmail.com
Fri Jul 3 13:33:32 CEST 2009
Yes, ofcourse this is the case when passing widgets to functions. And in
that case their memory is managed by the QT parent system.
If we pass implicitly shared classes to parameters, this will also not be a
problem. We assume we are passing the parameter with something like
function(new Class());
But in this case
void QStandardItemModel::appendRow ( QStandardItem * item )
if we use this method in the following way :
appendRow(new QStandardItem("itemText"));
the result will be undefined.
Ofcourse I may be wrong. Thank you for your opinions.
Best regards,
Patric
----- Original Message -----
From: "Andreas Pakulat" <apaku at gmx.de>
To: <qt-interest at trolltech.com>
Sent: Friday, July 03, 2009 1:55 PM
Subject: Re: [Qt-interest] Question regarding pointer parameters in
functions
> On 03.07.09 12:24:53, Patric wrote:
>> Is there a way to see which QT functions, that take pointers as
>> parameters, are deleting the memory after that.
>
> Usually the documentation states this explicitly if a certain function
> is taking over the responsibility. For QObject-derived classes the
> functions usually state explicitly if they reparent the given object
> unless
> its clearly visible from the context that this is the case (for example
> putting a widget into the layout of another widget).
>
> Andreas
>
> --
> Today's weirdness is tomorrow's reason why.
> -- Hunter S. Thompson
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
More information about the Qt-interest-old
mailing list