[Qt-interest] Question regarding pointer parameters in functions

Patric userqt at gmail.com
Mon Jul 6 21:46:58 CEST 2009


Hey guys, am I missing something ?
It's important, please. =)

Regards,
Patric

----- Original Message ----- 
From: "Patric" <userqt at gmail.com>
To: "Karsten Heimrich" <karsten.heimrich at nokia.com>
Cc: <qt-interest at trolltech.com>
Sent: Sunday, July 05, 2009 2:43 PM
Subject: Re: [Qt-interest] Question regarding pointer parameters in 
functions


> Yes, sure it deallocates all the memory by destruction. But the question 
> is, is the method who is adding items takes care of the allocation.
> Take for example this method :
> void QStatusBar::addPermanentWidget ( QWidget * widget, int stretch = 0 )
>
> If we add 5 widgets like this :
>
> addPermanentWidget(new QLabel("testLabel1"));
> addPermanentWidget(new QLabel("testLabel2"));
> addPermanentWidget(new QLabel("testLabel3"));
> addPermanentWidget(new QLabel("testLabel4"));
> addPermanentWidget(new QLabel("testLabel5"));
> http://doc.trolltech.com/4.5/qstatusbar.html#addPermanentWidget
>
> will it take care of the first 4 ? Is the method smart enough to delete 
> the memory of the old element, before add the new element.
>
> The same question for this one, ofcourse :
>
> void QStandardItemModel::appendRow ( QStandardItem * item )
> http://doc.qtsoftware.com/4.5/qstandarditemmodel.html#appendRow-2
>
> Regards,
> Patric
>
> ----- Original Message ----- 
> From: "Karsten Heimrich" <karsten.heimrich at nokia.com>
> To: "Patric" <userqt at gmail.com>
> Cc: <qt-interest at trolltech.com>
> Sent: Friday, July 03, 2009 4:02 PM
> Subject: Re: [Qt-interest] Question regarding pointer parameters in 
> functions
>
>
>> Hi Patric,
>>
>> Patric schrieb:
>>> Yes, you're right. It's natural to expect such thing from a model.
>>> I'll check the sources. ;)
>>
>> Or just check the documentation :) , for example:
>> http://doc.qtsoftware.com/4.5/qstandarditemmodel.html#dtor.QStandardItemModel
>>
>>
>> Regards,
>> -- 
>> Karsten Heimrich - karsten.heimrich (AT) nokia.com
>> Software Engineer - Nokia, Qt Software
>> Rudower Chaussee 13, 12489 Berlin, Germany
>>
>
> 




More information about the Qt-interest-old mailing list