Results 1 to 3 of 3

Thread: QTreeWidgetItemIterator with python

  1. #1
    Join Date
    Aug 2006
    Posts
    7
    Thanks
    1

    Default QTreeWidgetItemIterator with python

    Hi,

    I'm wondering how to use the iterator widget in python?.

    oIterWidget = QtGui.QTreeWidgetItemIterator(self.tocTL)
    ...

    looking for a simple example
    Thanks.

  2. #2
    Join Date
    Aug 2006
    Posts
    7
    Thanks
    1

    Default iterate in a tree widget

    Hi,

    I'm looking for a way to iterate thru all of the QTreeWidgetItem of a qTreeWidget in python?

    Basically i need to expand all of the widget items on first view, i only have 1 column

    thanks,

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTreeWidgetItemIterator with python

    QTreeWidgetItemIterator is not a widget, it's an iterator. You can use it to iterate over a collection of QTreeWidgetItems.

    Unfortunately there isn't much information about it in PyQt docs. You can use it += 1 to move to another element and it.value() to access the QTreeWidgetItem. The question is how do you know if you reached the last item?

    I don't have PyQt installed, but judging from the original Qt docs, probably you can do it like this:
    Python Code:
    1. while it.value():
    2. doSomethingWithItem( it.value() )
    3. it += 1
    To copy to clipboard, switch view to plain text mode 
    Last edited by jacek; 6th September 2006 at 17:54.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.