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.
假设我有一个 pyqt4 表格小部件,例如:
self.table = QtGui.QTableWidget(3,4)
有了self.table.clear()我可以删除表格的所有内容。但是,我怎样才能删除表格的所有单元格,而不仅仅是内容?
self.table.clear()
或者,您可以设置行数和列数:
self.table.setRowCount(0) self.table.setColumnCount(0)
没试过,但你可以试试:
for i in reversed(range(self.table.rowCount())): self.table.removeRow(i)