QTreeWidgetItem Parent
Verfasst: Donnerstag 7. August 2008, 20:14
Hi!
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!!!
thx,
andy
deutsche Antworten natürlich auch erwünscht
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!!!
thx,
andy
deutsche Antworten natürlich auch erwünscht