Python PYQT QTreeWidgetItem selected cell

5.5k views Asked by At

I have QTreeWidget like this

enter image description here

What should i do to get value from selected row and filename column ?

I have current selected item

 item = self.ui.files_treewidget.currentItem()

but how to access to specific cell?

1

There are 1 answers

0
rubik On

You can use QTreeWidgetItem.text(column), where column is an integer. In your example you would do:

item = self.ui.files_treewidget.currentItem()
filename = item.text(0)
size = item.text(1)