[PyQt] QTreeWidgetItem Parent

andYpsilon andreasfrickinger at me.com
Thu Aug 7 19:39:51 BST 2008


I have the following problem:

I filled a QTreeWidget with data and now want the currently selected item
back. But to process the data I also need the parents of it.

the .text() method works perfectly on the QTreeWidgetItem I created with
.currentItem(), but as soon as I am creating a QTreeWidgetItem of the parent
it says:

"NoneType Object does not have attribute text"

here is my code:

        #works perfectly
        currentShot = self.loadTree.currentItem()
        print currentShot.text(0)

        #throws described error
        currentScene = currentShot.parent()
        print currentScene.text(0)

If I print out the type of the QTreeWidgetItem's, they are both NoneType.
Please can anybody help me? I'm lost!!!


View this message in context: http://www.nabble.com/QTreeWidgetItem-Parent-tp18877067p18877067.html
Sent from the PyQt mailing list archive at Nabble.com.

More information about the PyQt mailing list