def _addObjectToTable(self, row, name, checked=True): tableItem = QTableWidgetItem(name) if checked: tableItem.setCheckState(Qt.Checked) else: tableItem.setCheckState(Qt.Unchecked) self._ui.tableWidget.setItem(row, self.objectTableHeaderColumns['visible'], tableItem)
def _addObjectToTable(self, row, name, obj): typeName = obj.typeName print(typeName) print(name) tableItem = QTableWidgetItem(name) tableItem.setCheckState(Qt.Checked) self._ui.tableWidget.setItem(row, self.objectTableHeaderColumns['visible'], tableItem) self._ui.tableWidget.setItem(row, self.objectTableHeaderColumns['type'], QTableWidgetItem(typeName))
def _addObjectToTable(self, row, name, obj, checked=True): typeName = obj.typeName print 'adding to table: %s (%s)'%(name, typeName) tableItem = QTableWidgetItem(name) if checked: tableItem.setCheckState(Qt.Checked) else: tableItem.setCheckState(Qt.Unchecked) self._ui.tableWidget.setItem(row, self.objectTableHeaderColumns['landmarks'], tableItem)
def _addObjectToTable(self, row, name, obj, checked=True): typeName = obj.typeName # print(typeName) # print(name) tableItem = QTableWidgetItem(name) if checked: tableItem.setCheckState(Qt.Checked) else: tableItem.setCheckState(Qt.Unchecked) self._ui.tableWidget.setItem(row, self.objectTableHeaderColumns['visible'], tableItem) self._ui.tableWidget.setItem(row, self.objectTableHeaderColumns['type'], QTableWidgetItem(typeName))
def populateUiSearchResult(self, results): self.tblSearchResult.clearContents() self.tblSearchResult.setRowCount(len(results)) for row in range(len(results)): newItem = QTableWidgetItem() newItem.setCheckState(Qt.Unchecked) self.tblSearchResult.setItem(row, 0, newItem) newTitle = QTableWidgetItem(results[row].getTitle().split("_免费高速下载")[0]) self.tblSearchResult.setItem(row, 1, newTitle) print QTableWidgetItem(results[row].getContent()) filesize = results[row].getContent().split(" 分享者")[0].split(' 文件大小:')[1].strip() newDesc = QTableWidgetItem(filesize) self.tblSearchResult.setItem(row, 2, newDesc) newUrl = QTableWidgetItem(results[row].getURL()) self.tblSearchResult.setItem(row, 3, newUrl) pass