[Qt-interest] Question regarding pointer parameters in functions
Patric
userqt at gmail.com
Fri Jul 3 14:32:06 CEST 2009
Yes, you're right. It's natural to expect such thing from a model.
I'll check the sources. ;)
Regards,
Patric
----- Original Message -----
From: "Andreas Pakulat" <apaku at gmx.de>
To: <qt-interest at trolltech.com>
Sent: Friday, July 03, 2009 3:12 PM
Subject: Re: [Qt-interest] Question regarding pointer parameters in
functions
> On 03.07.09 14:33:32, Patric wrote:
>> 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.
>
> No the result is not undefined, because a model always takes care of its
> content. In particular the standard item model assumes it has ownership of
> all its items, thats (IMHO) quite a natural thing to expect from a model
> and hence doesn't need explicit documentation.
>
> And in any case, if you're unsure, use the source ;)
>
> Andreas
>
> --
> Exercise caution in your daily affairs.
> _______________________________________________
> 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