[Qt-interest] childCount()
Srdjan Todorovic
todorovic.s at googlemail.com
Fri Jul 31 11:02:38 CEST 2009
Hi,
On 31/07/2009, Ender EREL <erelender at yahoo.com> wrote:
> Sujan Dasmahapatra wrote:
>> Dear Friends
>>
>> After I added a child TreeWidgetItem into an existing TreeWidgetItem but
>> the value of childCount() is not updated. What could be the reason can
>> anyone tell me ?
>>
>> *Sample*
>> *QTreeWidget *treeWidget = new QTreeWidget;*
>> *QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget);*
>> *QTreeWidgetItem *child = new QTreeWidgetItem(item);*
>> *child->setText("I am a child");*
>> *item1->addChild(child);*
>
> Is this a typo? You are adding the child to item1 and calling childCount
> of item.
It may be a typo, but in any case, 'child' should be a child of 'item' due to:
http://doc.trolltech.com/4.5/qtreewidgetitem.html#QTreeWidgetItem-3
Srdjan
More information about the Qt-interest-old
mailing list