[Qt-interest] Question regarding pointer parameters in functions
Scott Aron Bloom
Scott.Bloom at sabgroup.com
Mon Jul 6 22:04:57 CEST 2009
Have you considered reading the docs?
Have you considered looking at the source code?
http://doc.trolltech.com/4.5/qstatusbar.html#addPermanentWidget
Adds the given widget permanently to this status bar, reparenting the
widget if it isn't already a child of this QStatusBar object
Meaning, that the status is taking parental ownership of the label's in
your code...
When the status bar is deleted.. it will delete all its children...
Scott
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Patric
Sent: Monday, July 06, 2009 12:47 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Question regarding pointer parameters in
functions
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.QStandardItem
Model
>>
>>
>> Regards,
>> --
>> Karsten Heimrich - karsten.heimrich (AT) nokia.com
>> Software Engineer - Nokia, Qt Software
>> Rudower Chaussee 13, 12489 Berlin, Germany
>>
>
>
_______________________________________________
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