Qt-interest Archive, February 2007
TreeWidgetItem iteration
Message 1 in thread
Hi,
I´m using TreeWidgetItem and I need to iterate over a sequence of
items. How could I do that?
Thanks in advance.
--
[ signature omitted ]
Message 2 in thread
> I´m using TreeWidgetItem and I need to iterate over a sequence of
> items. How could I do that?
If your "sequence" is a list:
QList<QTreeWidgetItem *item> items;
foreach(QTreeWidgetItem *item, items)
{
item->. . .
}
Lingfa
--
[ signature omitted ]
Message 3 in thread
On 08.02.07 16:23:31, Bruno Tomazela wrote:
> I´m using TreeWidgetItem and I need to iterate over a sequence of
> items. How could I do that?
That depends on which container you use, i.e. in which type of container
the items are stored. Or do you want to iterate over the childs of such
an item? In that case use something like
for( int i = 0; i < item->childCount() ; ++i )
{
item->child(i)->doSth();
}
Andreas
--
[ signature omitted ]
Message 4 in thread
Thank you.
It helps a lot.
I just thought that could be methods such nextSibling() and
priorSibling() in QTreeWidget.
On 2/8/07, Andreas Pakulat <apaku@xxxxxx> wrote:
> On 08.02.07 16:23:31, Bruno Tomazela wrote:
> > I´m using TreeWidgetItem and I need to iterate over a sequence of
> > items. How could I do that?
>
> That depends on which container you use, i.e. in which type of container
> the items are stored. Or do you want to iterate over the childs of such
> an item? In that case use something like
>
> for( int i = 0; i < item->childCount() ; ++i )
> {
> item->child(i)->doSth();
> }
>
> Andreas
>
> --
> Perfect day for scrubbing the floor and other exciting things.
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
--
[ signature omitted ]