Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这样的 QTreeWidget
我应该怎么做才能从选定的行和文件名列中获取值?
我有当前选定的项目
item = self.ui.files_treewidget.currentItem()
但是如何访问特定的单元格?
您可以使用QTreeWidgetItem.text(column),其中 column 是一个整数。在您的示例中,您将执行以下操作:
QTreeWidgetItem.text(column)
item = self.ui.files_treewidget.currentItem() filename = item.text(0) size = item.text(1)